Detalhes do pacote

has-proto

inspect-js173.8mMIT1.2.0

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

prototype, proto, set, get

readme (leia-me)

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

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.2.0 - 2024-12-06

Commits

  • [Refactor] use dunder-proto instead of call-bind 6e5e76c
  • [actions] split out node 10-20, and 20+ 3b8e9e6
  • [Dev Deps] update @ljharb/tsconfig, gopd 57bcd00
  • [actions] skip npm ls in node < 10 ce3a4d7

v1.1.0 - 2024-12-01

Commits

  • [New] add accessor and mutator endpoints 144f6a9
  • [types] use shared config 8b597cf
  • [Refactor] cache result at module level 88418bd
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, tape d246200
  • [Deps] update gopd, reflect.getprototypeof 6f72364
  • [Tests] add @arethetypeswrong/cli 8194e1a
  • [Tests] replace aud with npm audit fd7ad11
  • [Dev Deps] update @types/tape 2695808
  • [Dev Deps] add missing peer dep fa4b2f7

v1.0.3 - 2024-02-19

Commits

  • [types] add missing declaration file 26ecade

v1.0.2 - 2024-02-19

Commits

  • add types 6435262
  • [Dev Deps] update @ljharb/eslint-config, aud, npmignore, tape f16a5e4
  • [Refactor] tiny cleanup d1f1a4b
  • [meta] add sideEffects flag e7ab1a6

v1.0.1 - 2022-12-21

Commits

  • [meta] correct URLs and description ef34483
  • [patch] add an additional criteria e81959e
  • [Dev Deps] update aud 2bec2c4

v1.0.0 - 2022-12-12

Commits