Server IP : 162.213.251.212 / Your IP : 18.118.120.15 [ Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/allssztx/www/easybuyer/node_modules/@jridgewell/set-array/ |
Upload File : |
# @jridgewell/set-array > Like a Set, but provides the index of the `key` in the backing array This is designed to allow synchronizing a second array with the contents of the backing array, like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, and there are never duplicates. ## Installation ```sh npm install @jridgewell/set-array ``` ## Usage ```js import { SetArray, get, put, pop } from '@jridgewell/set-array'; const sa = new SetArray(); let index = put(sa, 'first'); assert.strictEqual(index, 0); index = put(sa, 'second'); assert.strictEqual(index, 1); assert.deepEqual(sa.array, [ 'first', 'second' ]); index = get(sa, 'first'); assert.strictEqual(index, 0); pop(sa); index = get(sa, 'second'); assert.strictEqual(index, undefined); assert.deepEqual(sa.array, [ 'first' ]); ```