Frontend/25_01_07/mai/node_modules/has-proto
szabomarton 7f4a15b9c3 asd
2025-01-28 11:38:27 +01:00
..
.github asd 2025-01-28 11:38:27 +01:00
test asd 2025-01-28 11:38:27 +01:00
.eslintrc asd 2025-01-28 11:38:27 +01:00
accessor.d.ts asd 2025-01-28 11:38:27 +01:00
accessor.js asd 2025-01-28 11:38:27 +01:00
CHANGELOG.md asd 2025-01-28 11:38:27 +01:00
index.d.ts asd 2025-01-28 11:38:27 +01:00
index.js asd 2025-01-28 11:38:27 +01:00
LICENSE asd 2025-01-28 11:38:27 +01:00
mutator.d.ts asd 2025-01-28 11:38:27 +01:00
mutator.js asd 2025-01-28 11:38:27 +01:00
package.json asd 2025-01-28 11:38:27 +01:00
README.md asd 2025-01-28 11:38:27 +01:00
tsconfig.json asd 2025-01-28 11:38:27 +01:00

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