Created
November 27, 2012 06:07
-
-
Save cliffano/4152652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b = require('sandboxed-module').require('./b', {}); | |
b.foo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var item = []; | |
require('./c')(item); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.foo = function() { | |
var item = []; | |
var c = require('./c'); | |
console.log('BEFORE Constructor check: ' + (item.constructor === Array)); | |
console.log('BEFORE Instanceof check: ' + (item instanceof Array)); | |
console.log('BEFORE Array.isArray check: ' + Array.isArray(item)); | |
c(item); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (item) { | |
console.log('AFTER Constructor check: ' + (item.constructor === Array)); | |
console.log('AFTER Instanceof check: ' + (item instanceof Array)); | |
console.log('AFTER Array.isArray check: ' + Array.isArray(item)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "foo", | |
"version": "0.0.0", | |
"dependencies": { | |
"sandboxed-module": "0.1.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment