@hsds/utils-id
Advanced tools
+15
| // Source | ||
| // https://github.com/Shopify/javascript-utilities/blob/master/src/other.ts | ||
| export function createUniqueIDFactory(prefix = '') { | ||
| const index = createUniqueIndexFactory(1) | ||
| return prefixOverride => { | ||
| const namespace = prefixOverride || prefix || '' | ||
| return `${namespace}${index()}` | ||
| } | ||
| } | ||
| export function createUniqueIndexFactory(start = 1) { | ||
| let index = typeof start === 'number' ? start : 1 | ||
| return () => index++ | ||
| } |
+5
-4
@@ -5,10 +5,11 @@ # Changelog | ||
| ## [9.0.2-esm.1](https://github.com/helpscout/hsds/compare/utils-id-9.0.2-esm.0...utils-id-9.0.2-esm.1) (2024-04-10) | ||
| ## [9.0.2](https://github.com/helpscout/hsds/compare/utils-id-9.0.2-beta.3...utils-id-9.0.2) (2024-05-23) | ||
| ## [9.0.2-esm.0](https://github.com/helpscout/hsds/compare/utils-id-9.0.1...utils-id-9.0.2-esm.0) (2024-04-10) | ||
| ## [9.0.2-beta.3](https://github.com/helpscout/hsds/compare/utils-id-9.0.2-beta.2...utils-id-9.0.2-beta.3) (2024-05-14) | ||
| ## [9.0.2-beta.2](https://github.com/helpscout/hsds/compare/utils-id-9.0.2-beta.1...utils-id-9.0.2-beta.2) (2024-05-03) | ||
| ### Features | ||
| ## [9.0.2-beta.1](https://github.com/helpscout/hsds/compare/utils-id-9.0.2-beta.0...utils-id-9.0.2-beta.1) (2024-05-01) | ||
| * **workspace:** testing producing plain esm files ([25a69d2](https://github.com/helpscout/hsds/commit/25a69d2ba0671e2c1845a2beccb1f61fa71d4c1e)) | ||
| ## [9.0.2-beta.0](https://github.com/helpscout/hsds/compare/utils-id-9.0.1...utils-id-9.0.2-beta.0) (2024-04-30) | ||
@@ -15,0 +16,0 @@ ## [9.0.1](https://github.com/helpscout/hsds/compare/utils-id-9.0.1-next.4...utils-id-9.0.1) (2024-03-01) |
+3
-4
| { | ||
| "name": "@hsds/utils-id", | ||
| "version": "9.0.2-esm.1", | ||
| "module": "./index.esm.js", | ||
| "type": "module", | ||
| "main": "index.cjs" | ||
| "version": "9.0.2", | ||
| "main": "index.cjs", | ||
| "type": "commonjs" | ||
| } |
| export * from "./src/index"; |
-15
| // Source | ||
| // https://github.com/Shopify/javascript-utilities/blob/master/src/other.ts | ||
| function createUniqueIDFactory(prefix = '') { | ||
| const index = createUniqueIndexFactory(1); | ||
| return prefixOverride => { | ||
| const namespace = prefixOverride || prefix || ''; | ||
| return `${namespace}${index()}`; | ||
| }; | ||
| } | ||
| function createUniqueIndexFactory(start = 1) { | ||
| let index = typeof start === 'number' ? start : 1; | ||
| return () => index++; | ||
| } | ||
| export { createUniqueIDFactory, createUniqueIndexFactory }; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
9082
0.87%1
-50%6
-14.29%36
-5.26%No
NaN