@hsds/utils-id
Advanced tools
+43
| # Changelog | ||
| This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). | ||
| ## [4.1.0](https://github.com/helpscout/hsds/compare/utils-id-4.0.0...utils-id-4.1.0) (2022-08-03) | ||
| ### Features | ||
| * **workspace:** improves versioning packages ([b836826](https://github.com/helpscout/hsds/commit/b836826d549aeb7295498f1091c783136079f134)) | ||
| ### Bug Fixes | ||
| * **workspace:** remove esm module from projects ([829cc37](https://github.com/helpscout/hsds/commit/829cc3795f54a8bcfbc0c45b5bc36bd17463bf54)) | ||
| # [4.0.0](https://github.com/helpscout/hsds/compare/v3.54.2...v4.0.0) (2022-07-04) | ||
| ### Bug Fixes | ||
| * **workspace:** fix deploy + build tasks in projects ([2200a8c](https://github.com/helpscout/hsds/commit/2200a8cff30db25fe8e7b88f899a99c11bc6a79f)) | ||
| ### Features | ||
| * **workspace:** adds clean target to each project & use in deploy ([5048f41](https://github.com/helpscout/hsds/commit/5048f41d00cd82a464aaada502bc53ab4d4967e3)) | ||
| ### Reverts | ||
| * Revert "chore(release): 4.0.0" ([1836b0c](https://github.com/helpscout/hsds/commit/1836b0cb9bbd6a5adddcd556859099d64de7fe7d)) | ||
| ## [4.0.0](https://github.com/helpscout/hsds/compare/utils-id-3.54.11...utils-id-4.0.0) (2022-07-04) | ||
| ### [3.54.3-alpha.0](https://github.com/helpscout/hsds/compare/v3.54.2...v3.54.3-alpha.0) (2022-06-08) | ||
| ### Reverts | ||
| * Revert "chore(release): 4.0.0" ([1836b0c](https://github.com/helpscout/hsds/commit/1836b0cb9bbd6a5adddcd556859099d64de7fe7d)) |
+28
| "use strict"; | ||
| exports.__esModule = true; | ||
| exports.createUniqueIDFactory = createUniqueIDFactory; | ||
| exports.createUniqueIndexFactory = createUniqueIndexFactory; | ||
| // Source | ||
| // https://github.com/Shopify/javascript-utilities/blob/master/src/other.ts | ||
| function createUniqueIDFactory(prefix) { | ||
| if (prefix === void 0) { | ||
| prefix = ''; | ||
| } | ||
| const index = createUniqueIndexFactory(1); | ||
| return prefixOverride => { | ||
| const namespace = prefixOverride || prefix || ''; | ||
| return `${namespace}${index()}`; | ||
| }; | ||
| } | ||
| function createUniqueIndexFactory(start) { | ||
| if (start === void 0) { | ||
| start = 1; | ||
| } | ||
| let index = typeof start === 'number' ? start : 1; | ||
| return () => index++; | ||
| } |
+11
| "use strict"; | ||
| exports.__esModule = true; | ||
| var _id = require("./id"); | ||
| Object.keys(_id).forEach(function (key) { | ||
| if (key === "default" || key === "__esModule") return; | ||
| if (key in exports && exports[key] === _id[key]) return; | ||
| exports[key] = _id[key]; | ||
| }); |
+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++ | ||
| } |
+2
-2
| { | ||
| "name": "@hsds/utils-id", | ||
| "version": "4.0.0", | ||
| "main": "./index.umd.js", | ||
| "version": "4.1.0", | ||
| "main": "./index.cjs.js", | ||
| "module": "./index.esm.js", | ||
| "typings": "./index.d.ts" | ||
| } |
+6
-1
@@ -5,2 +5,7 @@ # utils-id | ||
| Includes: | ||
| - `createUniqueIDFactory` | ||
| - `createUniqueIndexFactory` | ||
| ## Running unit tests | ||
@@ -10,2 +15,2 @@ | ||
| > Up to date with hsds-react `v3.54.2` | ||
| > Up to date with hsds-react `v3.54.11` |
-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 }; |
-26
| (function (global, factory) { | ||
| typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
| typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
| (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.UtilsId = {})); | ||
| })(this, (function (exports) { 'use strict'; | ||
| // 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++; | ||
| } | ||
| exports.createUniqueIDFactory = createUniqueIDFactory; | ||
| exports.createUniqueIndexFactory = createUniqueIndexFactory; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| })); |
3260
74.99%6
50%42
16.67%15
50%