xiaoxin c949ecdb9d 第一版 il y a 1 an
..
.github c949ecdb9d 第一版 il y a 1 an
helpers c949ecdb9d 第一版 il y a 1 an
test c949ecdb9d 第一版 il y a 1 an
.eslintrc c949ecdb9d 第一版 il y a 1 an
CHANGELOG.md c949ecdb9d 第一版 il y a 1 an
LICENSE c949ecdb9d 第一版 il y a 1 an
README.md c949ecdb9d 第一版 il y a 1 an
accessor.d.ts c949ecdb9d 第一版 il y a 1 an
accessor.js c949ecdb9d 第一版 il y a 1 an
index.d.ts c949ecdb9d 第一版 il y a 1 an
index.js c949ecdb9d 第一版 il y a 1 an
mutator.d.ts c949ecdb9d 第一版 il y a 1 an
mutator.js c949ecdb9d 第一版 il y a 1 an
package.json c949ecdb9d 第一版 il y a 1 an
tsconfig.json c949ecdb9d 第一版 il y a 1 an

README.md

has-proto Version Badge

github actions coverage License Downloads

npm badge

Does this environment have the ability to set the [[Prototype]] of an object on creation with __proto__?

Example

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);
}

Tests

Simply clone the repo, npm install, and run npm test