This seems to be a very weird bug, but when using ejdb with node-webkit, .constructor === Array
returns false for actual arrays. This is because node-webkit runs ejdb as a nodeĀ
module in a different JavaScript context (WebKit context), so there are actually
two unique objects that represent any constructor (one of each scope). So instead
of comparing if .constructor references to the same object as "Array", we just check
if the name of the constructor is "Array".
if (!jsarr) {
return [];
}
- if (jsarr.constructor !== Array) {
+ if (! (jsarr.constructor.name == "Array")) {
jsarr = [jsarr];
}
if (typeof opts == "function") {