|
vor 3 Wochen | |
---|---|---|
.. | ||
.github | vor 3 Wochen | |
test | vor 3 Wochen | |
.eslintrc | vor 3 Wochen | |
CHANGELOG.md | vor 3 Wochen | |
LICENSE | vor 3 Wochen | |
README.md | vor 3 Wochen | |
accessor.d.ts | vor 3 Wochen | |
accessor.js | vor 3 Wochen | |
index.d.ts | vor 3 Wochen | |
index.js | vor 3 Wochen | |
mutator.d.ts | vor 3 Wochen | |
mutator.js | vor 3 Wochen | |
package.json | vor 3 Wochen | |
tsconfig.json | vor 3 Wochen |
Does this environment have the ability to set the [[Prototype]] of an object on creation with __proto__
?
var hasProto = require('has-proto');
var assert = require('assert');
assert.equal(typeof hasProto(), 'boolean');
var hasProtoAccessor = require('has-proto/accessor')();
if (hasProtoAccessor) {
assert.equal([].__proto__, Array.prototype);
} else {
assert(!('__proto__' in Object.prototype));
}
var hasProtoMutator = require('has-proto/mutator');
var obj = {};
assert('toString' in obj);
obj.__proto__ = null;
if (hasProtoMutator) {
assert(!('toString' in obj));
} else {
assert('toString' in obj);
assert.equal(obj.__proto__, null);
}
Simply clone the repo, npm install
, and run npm test