source: imaps-frontend/node_modules/side-channel/README.md@ 79a0317

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.1 KB
Line 
1# side-channel <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
10Store information about any JS value in a side channel. Uses WeakMap if available.
11
12Warning: in an environment that lacks `WeakMap`, this implementation will leak memory until you `delete` the `key`.
13
14## Getting started
15
16```sh
17npm install --save side-channel
18```
19
20## Usage/Examples
21
22```js
23const assert = require('assert');
24const getSideChannel = require('side-channel');
25
26const channel = getSideChannel();
27
28const key = {};
29assert.equal(channel.has(key), false);
30assert.throws(() => channel.assert(key), TypeError);
31
32channel.set(key, 42);
33
34channel.assert(key); // does not throw
35assert.equal(channel.has(key), true);
36assert.equal(channel.get(key), 42);
37
38channel.delete(key);
39assert.equal(channel.has(key), false);
40assert.throws(() => channel.assert(key), TypeError);
41```
42
43## Tests
44
45Clone the repo, `npm install`, and run `npm test`
46
47[package-url]: https://npmjs.org/package/side-channel
48[npm-version-svg]: https://versionbadg.es/ljharb/side-channel.svg
49[deps-svg]: https://david-dm.org/ljharb/side-channel.svg
50[deps-url]: https://david-dm.org/ljharb/side-channel
51[dev-deps-svg]: https://david-dm.org/ljharb/side-channel/dev-status.svg
52[dev-deps-url]: https://david-dm.org/ljharb/side-channel#info=devDependencies
53[npm-badge-png]: https://nodei.co/npm/side-channel.png?downloads=true&stars=true
54[license-image]: https://img.shields.io/npm/l/side-channel.svg
55[license-url]: LICENSE
56[downloads-image]: https://img.shields.io/npm/dm/side-channel.svg
57[downloads-url]: https://npm-stat.com/charts.html?package=side-channel
58[codecov-image]: https://codecov.io/gh/ljharb/side-channel/branch/main/graphs/badge.svg
59[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel/
60[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel
61[actions-url]: https://github.com/ljharb/side-channel/actions
Note: See TracBrowser for help on using the repository browser.