{"name":"@jridgewell/set-array","version":"1.2.0","description":"Like a Set, but provides the index of the `key` in the backing array","keywords":[],"author":{"name":"Justin Ridgewell","email":"justin@ridgewell.name"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/jridgewell/set-array.git"},"main":"dist/set-array.umd.js","module":"dist/set-array.mjs","typings":"dist/types/set-array.d.ts","exports":{".":[{"types":"./dist/types/set-array.d.ts","browser":"./dist/set-array.umd.js","require":"./dist/set-array.umd.js","import":"./dist/set-array.mjs"},"./dist/set-array.umd.js"],"./package.json":"./package.json"},"engines":{"node":">=6.0.0"},"scripts":{"prebuild":"rm -rf dist","build":"run-s -n build:*","build:rollup":"rollup -c rollup.config.js","build:ts":"tsc --project tsconfig.build.json","lint":"run-s -n lint:*","lint:prettier":"npm run test:lint:prettier -- --write","lint:ts":"npm run test:lint:ts -- --fix","test":"run-s -n test:lint test:only","test:debug":"mocha --inspect-brk","test:lint":"run-s -n test:lint:*","test:lint:prettier":"prettier --check '{src,test}/**/*.ts'","test:lint:ts":"eslint '{src,test}/**/*.ts'","test:only":"mocha","test:coverage":"c8 mocha","test:watch":"mocha --watch","prepublishOnly":"npm run preversion","preversion":"run-s test build"},"devDependencies":{"@rollup/plugin-typescript":"8.3.0","@types/mocha":"9.1.1","@types/node":"17.0.29","@typescript-eslint/eslint-plugin":"5.10.0","@typescript-eslint/parser":"5.10.0","c8":"7.11.0","eslint":"8.7.0","eslint-config-prettier":"8.3.0","mocha":"9.2.0","npm-run-all":"4.1.5","prettier":"2.5.1","rollup":"2.66.0","tsx":"4.7.1","typescript":"4.5.5"},"_id":"@jridgewell/set-array@1.2.0","gitHead":"61dd83d01b6d55d3778843df753b4900e55b0135","bugs":{"url":"https://github.com/jridgewell/set-array/issues"},"homepage":"https://github.com/jridgewell/set-array#readme","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-0MQgv8btjdoiER7W+VRWJIfg3KBeu3zEZp0Nxh/y2Vx1x498DqteGoBUrJ61OK5qvABTS5kOxFRxwgSqnAJKFw==","shasum":"2eb73c4d1bd9a7fc1ba5f98e18f412487561f080","tarball":"http://registry-npm.ywwl.com/@jridgewell/set-array/download/@jridgewell/set-array-1.2.0.tgz","fileCount":8,"unpackedSize":17927,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCi3+jBpH43XTCjSqrJnZ5Oid4GPLjLqmt0ZpsXIMGmmwIgTAECk4v9ckLrGlPjq8NK1bckF4JN96Xnn9RWvHFbCCY="}],"size":4167,"noattachment":false,"key":"/@jridgewell/set-array/-/@jridgewell/set-array-1.2.0.tgz"},"_npmUser":{"name":"jridgewell","email":"justin+npm@ridgewell.name"},"directories":{},"maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/set-array_1.2.0_1709186317957_0.18403706578989953"},"_hasShrinkwrap":false,"readme":"# @jridgewell/set-array\n\n> Like a Set, but provides the index of the `key` in the backing array\n\nThis is designed to allow synchronizing a second array with the contents of the backing array, like\nhow in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, and there\nare never duplicates.\n\n## Installation\n\n```sh\nnpm install @jridgewell/set-array\n```\n\n## Usage\n\n```js\nimport { SetArray, get, put, pop } from '@jridgewell/set-array';\n\nconst sa = new SetArray();\n\nlet index = put(sa, 'first');\nassert.strictEqual(index, 0);\n\nindex = put(sa, 'second');\nassert.strictEqual(index, 1);\n\nassert.deepEqual(sa.array, [ 'first', 'second' ]);\n\nindex = get(sa, 'first');\nassert.strictEqual(index, 0);\n\npop(sa);\nindex = get(sa, 'second');\nassert.strictEqual(index, undefined);\nassert.deepEqual(sa.array, [ 'first' ]);\n```\n","publish_time":1709186318104,"_cnpm_publish_time":1709186318104,"dist-tags":{"latest":"1.2.1"}}