source: imaps-frontend/node_modules/has-proto/README.md@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# has-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![License][license-image]][license-url]
6[![Downloads][downloads-image]][downloads-url]
7
8[![npm badge][npm-badge-png]][package-url]
9
10Does this environment have the ability to set the [[Prototype]] of an object on creation with `__proto__`?
11
12## Example
13
14```js
15var hasProto = require('has-proto');
16var assert = require('assert');
17
18assert.equal(typeof hasProto(), 'boolean');
19
20var hasProtoAccessor = require('has-proto/accessor')();
21if (hasProtoAccessor) {
22 assert.equal([].__proto__, Array.prototype);
23} else {
24 assert(!('__proto__' in Object.prototype));
25}
26
27var hasProtoMutator = require('has-proto/mutator');
28var obj = {};
29assert('toString' in obj);
30
31obj.__proto__ = null;
32if (hasProtoMutator) {
33 assert(!('toString' in obj));
34} else {
35 assert('toString' in obj);
36 assert.equal(obj.__proto__, null);
37}
38```
39
40## Tests
41Simply clone the repo, `npm install`, and run `npm test`
42
43[package-url]: https://npmjs.org/package/has-proto
44[npm-version-svg]: https://versionbadg.es/inspect-js/has-proto.svg
45[deps-svg]: https://david-dm.org/inspect-js/has-proto.svg
46[deps-url]: https://david-dm.org/inspect-js/has-proto
47[dev-deps-svg]: https://david-dm.org/inspect-js/has-proto/dev-status.svg
48[dev-deps-url]: https://david-dm.org/inspect-js/has-proto#info=devDependencies
49[npm-badge-png]: https://nodei.co/npm/has-proto.png?downloads=true&stars=true
50[license-image]: https://img.shields.io/npm/l/has-proto.svg
51[license-url]: LICENSE
52[downloads-image]: https://img.shields.io/npm/dm/has-proto.svg
53[downloads-url]: https://npm-stat.com/charts.html?package=has-proto
54[codecov-image]: https://codecov.io/gh/inspect-js/has-proto/branch/main/graphs/badge.svg
55[codecov-url]: https://app.codecov.io/gh/inspect-js/has-proto/
56[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-proto
57[actions-url]: https://github.com/inspect-js/has-proto/actions
Note: See TracBrowser for help on using the repository browser.