has-proto <sup>Version Badge</sup>

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

has-proto - Installation

To install has-proto via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install has-proto --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install has-proto

Learn more about the config option.

PNPM

pnpm install has-proto --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install has-proto --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

has-proto - Download

Download Tarball (v1.2.0)

Integrity sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==
SHASUM 5de5a6eabd95fdffd9818b43055e8065e39fe9d5
Tarball https://js.registry.sudovanilla.org/has-proto/-/has-proto-1.2.0.tgz