@necto/id 1.6.6 → 1.6.8
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.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -12
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@necto/assert`),t=require(`@necto/constants`),n=require(`@necto/crypto`);function r(r=21,i=Array.from([...t.ALPHABET.LOWERCASE,...t.ALPHABET.CAPITALIZED])){(0,e.assert)(r>0,`Length must be a positive integer.`);let a=(0,n.randomBytes)(r);return Array.from(a).map(e=>i[e%i.length]).join(``)}exports.id=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ALPHABET"],"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":"2JAkBA,SAAgB,EACd,EAAS,GACT,EAAoB,MAAM,KAAK,CAC7B,GAAGA,EAAAA,SAAS,UACZ,GAAGA,EAAAA,SAAS,YACb,CAAC,CACM,EACR,EAAA,EAAA,QAAO,EAAS,EAAG,qCAAqC,CAExD,IAAM,GAAA,EAAA,EAAA,aAAuC,EAAO,CACpD,OAAO,MAAM,KAAK,EAAiC,CAChD,IAAK,GAA0B,EAAQ,EAAQ,EAAQ,QAAQ,CAC/D,KAAK,GAAG"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/id.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
3
4
|
*
|
|
@@ -12,5 +13,6 @@
|
|
|
12
13
|
* @returns A randomly generated ID string.
|
|
13
14
|
*/
|
|
14
15
|
declare function id(length?: number, charset?: string[]): string;
|
|
15
|
-
|
|
16
|
+
//#endregion
|
|
16
17
|
export { id };
|
|
18
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/id.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) Corinvo, LLC. and affiliates.
|
|
3
4
|
*
|
|
@@ -12,5 +13,6 @@
|
|
|
12
13
|
* @returns A randomly generated ID string.
|
|
13
14
|
*/
|
|
14
15
|
declare function id(length?: number, charset?: string[]): string;
|
|
15
|
-
|
|
16
|
+
//#endregion
|
|
16
17
|
export { id };
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{assert as e}from"@necto/assert";import{ALPHABET as
|
|
1
|
+
import{assert as e}from"@necto/assert";import{ALPHABET as t}from"@necto/constants";import{randomBytes as n}from"@necto/crypto";function r(r=21,i=Array.from([...t.LOWERCASE,...t.CAPITALIZED])){e(r>0,`Length must be a positive integer.`);let a=n(r);return Array.from(a).map(e=>i[e%i.length]).join(``)}export{r 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 { 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":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"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":"+HAkBA,SAAgB,EACd,EAAS,GACT,EAAoB,MAAM,KAAK,CAC7B,GAAG,EAAS,UACZ,GAAG,EAAS,YACb,CAAC,CACM,CACR,EAAO,EAAS,EAAG,qCAAqC,CAExD,IAAM,EAA2B,EAAY,EAAO,CACpD,OAAO,MAAM,KAAK,EAAiC,CAChD,IAAK,GAA0B,EAAQ,EAAQ,EAAQ,QAAQ,CAC/D,KAAK,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necto/id",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
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",
|
|
@@ -25,18 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"author": "Corinvo OSS Team",
|
|
27
27
|
"license": "MIT",
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@types/node": "^22.14.1",
|
|
30
|
-
"@types/randombytes": "^2.0.3",
|
|
31
|
-
"tsup": "^8.4.0"
|
|
32
|
-
},
|
|
33
28
|
"dependencies": {
|
|
34
|
-
"@necto/assert": "1.0.
|
|
35
|
-
"@necto/crypto": "1.0.
|
|
36
|
-
"@necto/constants": "
|
|
29
|
+
"@necto/assert": "1.0.1",
|
|
30
|
+
"@necto/crypto": "1.0.1",
|
|
31
|
+
"@necto/constants": "2.0.1"
|
|
37
32
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/nectoutil/NodeKit",
|
|
36
|
+
"directory": "packages/@necto/necto-id"
|
|
41
37
|
}
|
|
42
38
|
}
|