@necto/id 1.6.7 → 1.6.9

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 CHANGED
@@ -1,2 +1,2 @@
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;
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
@@ -1 +1 @@
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"}
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([...ALPHABET.LOWERCASE, ...ALPHABET.CAPITALIZED])\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,CAAC,GAAGA,EAAAA,SAAS,UAAW,GAAGA,EAAAA,SAAS,WAAW,CAAC,EACvE,EACR,EAAA,EAAA,OAAA,CAAO,EAAS,EAAG,oCAAoC,EAEvD,IAAM,GAAA,EAAA,EAAA,YAAA,CAAuC,CAAM,EACnD,OAAO,MAAM,KAAK,CAAgC,CAAC,CAChD,IAAK,GAA0B,EAAQ,EAAQ,EAAQ,OAAO,CAAC,CAC/D,KAAK,EAAE,CACZ"}
@@ -15,4 +15,4 @@
15
15
  declare function id(length?: number, charset?: string[]): string;
16
16
  //#endregion
17
17
  export { id };
18
- //# sourceMappingURL=index-D2fDmT8Z.d.ts.map
18
+ //# sourceMappingURL=index.d.cts.map
@@ -15,4 +15,4 @@
15
15
  declare function id(length?: number, charset?: string[]): string;
16
16
  //#endregion
17
17
  export { id };
18
- //# sourceMappingURL=index-BqQ2Nd4-.d.cts.map
18
+ //# sourceMappingURL=index.d.mts.map
@@ -1,2 +1,2 @@
1
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
- //# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","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([...ALPHABET.LOWERCASE, ...ALPHABET.CAPITALIZED])\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,CAAC,GAAG,EAAS,UAAW,GAAG,EAAS,WAAW,CAAC,EACvE,CACR,EAAO,EAAS,EAAG,oCAAoC,EAEvD,IAAM,EAA2B,EAAY,CAAM,EACnD,OAAO,MAAM,KAAK,CAAgC,CAAC,CAChD,IAAK,GAA0B,EAAQ,EAAQ,EAAQ,OAAO,CAAC,CAC/D,KAAK,EAAE,CACZ"}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@necto/id",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
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",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.mts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
11
+ "types": "./dist/index.d.mts",
12
+ "import": "./dist/index.mjs",
13
13
  "require": "./dist/index.cjs"
14
14
  }
15
15
  },
@@ -26,9 +26,9 @@
26
26
  "author": "Corinvo OSS Team",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@necto/assert": "1.0.0",
30
- "@necto/crypto": "1.0.0",
31
- "@necto/constants": "2.0.0"
29
+ "@necto/assert": "1.0.2",
30
+ "@necto/crypto": "1.0.2",
31
+ "@necto/constants": "2.0.2"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
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"}