|
|
2 tygodni temu | |
|---|---|---|
| .. | ||
| .github | 2 tygodni temu | |
| test | 2 tygodni temu | |
| .eslintrc | 2 tygodni temu | |
| CHANGELOG.md | 2 tygodni temu | |
| LICENSE | 2 tygodni temu | |
| README.md | 2 tygodni temu | |
| accessor.d.ts | 2 tygodni temu | |
| accessor.js | 2 tygodni temu | |
| index.d.ts | 2 tygodni temu | |
| index.js | 2 tygodni temu | |
| mutator.d.ts | 2 tygodni temu | |
| mutator.js | 2 tygodni temu | |
| package.json | 2 tygodni temu | |
| tsconfig.json | 2 tygodni temu | |
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