source: imaps-frontend/node_modules/internal-slot/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.3 KB
Line 
1# internal-slot <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![dependency status][deps-svg]][deps-url]
6[![dev dependency status][dev-deps-svg]][dev-deps-url]
7[![License][license-image]][license-url]
8[![Downloads][downloads-image]][downloads-url]
9
10[![npm badge][npm-badge-png]][package-url]
11
12Truly private storage, akin to the JS spec’s concept of internal slots.
13
14Uses a WeakMap when available; a Map when not; and a regular object in even older engines. Performance and garbage collection behavior will reflect the environment’s capabilities accordingly.
15
16## Example
17
18```js
19var SLOT = require('internal-slot');
20var assert = require('assert');
21
22var o = {};
23
24assert.throws(function () { SLOT.assert(o, 'foo'); });
25
26assert.equal(SLOT.has(o, 'foo'), false);
27assert.equal(SLOT.get(o, 'foo'), undefined);
28
29SLOT.set(o, 'foo', 42);
30
31assert.equal(SLOT.has(o, 'foo'), true);
32assert.equal(SLOT.get(o, 'foo'), 42);
33
34assert.doesNotThrow(function () { SLOT.assert(o, 'foo'); });
35```
36
37## Tests
38Simply clone the repo, `npm install`, and run `npm test`
39
40## Security
41
42Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
43
44[package-url]: https://npmjs.org/package/internal-slot
45[npm-version-svg]: https://versionbadg.es/ljharb/internal-slot.svg
46[deps-svg]: https://david-dm.org/ljharb/internal-slot.svg
47[deps-url]: https://david-dm.org/ljharb/internal-slot
48[dev-deps-svg]: https://david-dm.org/ljharb/internal-slot/dev-status.svg
49[dev-deps-url]: https://david-dm.org/ljharb/internal-slot#info=devDependencies
50[npm-badge-png]: https://nodei.co/npm/internal-slot.png?downloads=true&stars=true
51[license-image]: https://img.shields.io/npm/l/internal-slot.svg
52[license-url]: LICENSE
53[downloads-image]: https://img.shields.io/npm/dm/internal-slot.svg
54[downloads-url]: https://npm-stat.com/charts.html?package=internal-slot
55[codecov-image]: https://codecov.io/gh/ljharb/internal-slot/branch/main/graphs/badge.svg
56[codecov-url]: https://app.codecov.io/gh/ljharb/internal-slot/
57[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/internal-slot
58[actions-url]: https://github.com/ljharb/internal-slot/actions
Note: See TracBrowser for help on using the repository browser.