@jridgewell/set-array
Advanced tools
Comparing version
@@ -17,2 +17,6 @@ (function (global, factory) { | ||
/** | ||
* Pops the last added item out of the SetArray. | ||
*/ | ||
exports.pop = void 0; | ||
/** | ||
* SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the | ||
@@ -41,2 +45,9 @@ * index of the `key` in the backing array. | ||
}; | ||
exports.pop = (strarr) => { | ||
const { array, _indexes: indexes } = strarr; | ||
if (array.length === 0) | ||
return; | ||
const last = array.pop(); | ||
indexes[last] = undefined; | ||
}; | ||
})(); | ||
@@ -43,0 +54,0 @@ |
@@ -11,2 +11,6 @@ /** | ||
/** | ||
* Pops the last added item out of the SetArray. | ||
*/ | ||
export declare let pop: (strarr: SetArray) => void; | ||
/** | ||
* SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the | ||
@@ -13,0 +17,0 @@ * index of the `key` in the backing array. |
{ | ||
"name": "@jridgewell/set-array", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Like a Set, but provides the index of the `key` in the backing array", | ||
@@ -48,2 +48,4 @@ "keywords": [], | ||
"@rollup/plugin-typescript": "8.3.0", | ||
"@types/mocha": "9.1.1", | ||
"@types/node": "17.0.29", | ||
"@typescript-eslint/eslint-plugin": "5.10.0", | ||
@@ -50,0 +52,0 @@ "@typescript-eslint/parser": "5.10.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
13610
16.72%127
25.74%13
18.18%