On 1/21/11, Andrew Stein <[email protected]> wrote:
> My employer, Benchmark Solutions, has released this open source
> framework y'all may enjoy:
>
> https://github.com/benchmark-solutions/methadone
[...]
> There are some existing bugs and questionable design decisions, but we
> would love constructive feedback from the community!
function getOrCreate(name) {
var obj = window;
name = name.split(".");
for (var namespace in name) {
if (name.hasOwnProperty(namespace)) {
obj[name[namespace]] = obj[name[namespace]] || {};
obj = obj[name[namespace]];
}
}
return obj;
}.
Don't use for-in on an Array. Instead, use a for loop. The remove the
hasOwnProperty check -- that essentially does as e.g.
["foo", "bar"].hasOwnProperty("0");
--
Garrett
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]