@necto/id 1.6.5 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var u=(t,r)=>{for(var o in r)e(t,o,{get:r[o],enumerable:!0})},g=(t,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let m of f(r))!p.call(t,m)&&m!==o&&e(t,m,{get:()=>r[m],enumerable:!(n=A(r,m))||n.enumerable});return t};var b=t=>g(e({},"__esModule",{value:!0}),t);var E={};u(E,{id:()=>y});module.exports=b(E);var a=require("@necto/assert"),i=require("@necto/constants"),s=require("@necto/crypto");function y(t=21,r=Array.from([...i.ALPHABET.LOWERCASE,...i.ALPHABET.CAPITALIZED])){(0,a.assert)(t>0,"Length must be a positive integer.");let o=(0,s.randomBytes)(t);return Array.from(o).map(n=>r[n%r.length]).join("")}0&&(module.exports={id});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport * from './id';\n","/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport * from './id';\n","/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { assert } from '@necto/assert';\nimport { ALPHABET } from '@necto/constants';\nimport { randomBytes } from '@necto/crypto';\n\n/**\n * Generates a random ID of the specified length using the provided character set.\n * @param length - The length of the ID to generate.\n * @param charset - The character set to use for generating the ID (default: ALPHABET_COMBINED).\n * @returns A randomly generated ID string.\n */\nexport function id(\n length = 21,\n charset: string[] = Array.from([\n ...ALPHABET.LOWERCASE,\n ...ALPHABET.CAPITALIZED\n ])\n): string {\n assert(length > 0, 'Length must be a positive integer.');\n\n const randomValues: Uint8Array = randomBytes(length);\n return Array.from(randomValues as Iterable<number>)\n .map((value: number): string => charset[value % charset.length])\n .join('');\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,QAAAE,IAAA,eAAAC,EAAAH,GCQA,IAAAI,EAAuB,yBACvBC,EAAyB,4BACzBC,EAA4B,yBAQrB,SAASC,EACdC,EAAS,GACTC,EAAoB,MAAM,KAAK,CAC7B,GAAG,WAAS,UACZ,GAAG,WAAS,WACd,CAAC,EACO,IACR,UAAOD,EAAS,EAAG,oCAAoC,EAEvD,IAAME,KAA2B,eAAYF,CAAM,EACnD,OAAO,MAAM,KAAKE,CAAgC,EAC/C,IAAKC,GAA0BF,EAAQE,EAAQF,EAAQ,MAAM,CAAC,EAC9D,KAAK,EAAE,CACZ","names":["index_exports","__export","id","__toCommonJS","import_assert","import_constants","import_crypto","id","length","charset","randomValues","value"]}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{assert as e}from"@necto/assert";import{ALPHABET as o}from"@necto/constants";import{randomBytes as i}from"@necto/crypto";function f(r=21,t=Array.from([...o.LOWERCASE,...o.CAPITALIZED])){e(r>0,"Length must be a positive integer.");let m=i(r);return Array.from(m).map(n=>t[n%t.length]).join("")}export{f as id};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport
|
|
1
|
+
{"version":3,"sources":["../src/id.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { assert } from '@necto/assert';\nimport { ALPHABET } from '@necto/constants';\nimport { randomBytes } from '@necto/crypto';\n\n/**\n * Generates a random ID of the specified length using the provided character set.\n * @param length - The length of the ID to generate.\n * @param charset - The character set to use for generating the ID (default: ALPHABET_COMBINED).\n * @returns A randomly generated ID string.\n */\nexport function id(\n length = 21,\n charset: string[] = Array.from([\n ...ALPHABET.LOWERCASE,\n ...ALPHABET.CAPITALIZED\n ])\n): string {\n assert(length > 0, 'Length must be a positive integer.');\n\n const randomValues: Uint8Array = randomBytes(length);\n return Array.from(randomValues as Iterable<number>)\n .map((value: number): string => charset[value % charset.length])\n .join('');\n}\n"],"mappings":"AAQA,OAAS,UAAAA,MAAc,gBACvB,OAAS,YAAAC,MAAgB,mBACzB,OAAS,eAAAC,MAAmB,gBAQrB,SAASC,EACdC,EAAS,GACTC,EAAoB,MAAM,KAAK,CAC7B,GAAGJ,EAAS,UACZ,GAAGA,EAAS,WACd,CAAC,EACO,CACRD,EAAOI,EAAS,EAAG,oCAAoC,EAEvD,IAAME,EAA2BJ,EAAYE,CAAM,EACnD,OAAO,MAAM,KAAKE,CAAgC,EAC/C,IAAKC,GAA0BF,EAAQE,EAAQF,EAAQ,MAAM,CAAC,EAC9D,KAAK,EAAE,CACZ","names":["assert","ALPHABET","randomBytes","id","length","charset","randomValues","value"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necto/id",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Necto's library for generating algorithmic ID's based on specified parameters.",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
"tsup": "^8.4.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"@necto/
|
|
34
|
+
"@necto/assert": "1.0.0",
|
|
35
|
+
"@necto/crypto": "1.0.0",
|
|
36
|
+
"@necto/constants": "1.4.5"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "tsup --minify",
|