uuid64ts
Advanced tools
Comparing version 0.1.5 to 0.1.7
{ | ||
"name": "uuid64ts", | ||
"version": "0.1.5", | ||
"version": "0.1.7", | ||
"description": "UUID v4 (random) Typescript/Javascript package with a custom base 64 encoding added.", | ||
"scripts": { | ||
"clear-test": "rimraf test/**/*.js test/**/*.map test/**/*.d.ts", | ||
"coverage": "npm run clear-test && nyc --reporter=text mocha -r ts-node/register test/**/*.spec.ts", | ||
"coverage-html": "npm run clear-test && nyc --reporter=html mocha -r ts-node/register test/**/*.spec.ts", | ||
"start": "rimraf dist/**/* && tsc --watch", | ||
"test": "mocha -r ts-node/register test/**/*.spec.ts" | ||
"test": "npm run clear-test && mocha -b -r ts-node/register test/**/*.spec.ts" | ||
}, | ||
@@ -29,2 +32,3 @@ "keywords": [ | ||
"mocha": "^7.1.0", | ||
"nyc": "^15.0.0", | ||
"rimraf": "^3.0.2", | ||
@@ -31,0 +35,0 @@ "ts-node": "^8.6.2", |
@@ -172,3 +172,2 @@ /** | ||
if (32 !== data.length) { | ||
console.log(data); | ||
const mess = `Expected hex string length of 32 characters but was given length: ${data.length}`; | ||
@@ -198,2 +197,13 @@ throw new RangeError(mess); | ||
} | ||
/** | ||
* Convert from a standard UUID to a hexadecimal encoded UUID. | ||
* | ||
* NOTE: This method does not verify input is valid UUID. | ||
* | ||
* @param {string} data The standard UUID. | ||
* @returns {string} Returns a hexadecimal encoded UUID. | ||
*/ | ||
public static fromUuidToHexString(data: string): string { | ||
return data.replace(/-/g, ''); | ||
} | ||
public get [Symbol.toStringTag]() { | ||
@@ -235,2 +245,3 @@ return 'Uuid4'; | ||
} | ||
// `result` is modified in place. | ||
let result = new Uint8Array(16); | ||
@@ -243,3 +254,3 @@ window.crypto.getRandomValues(result); | ||
* | ||
* @type {{[key: string]: string}} | ||
* @type {object} | ||
* @private | ||
@@ -246,0 +257,0 @@ */ |
@@ -11,2 +11,3 @@ { | ||
"moduleResolution": "node", | ||
"newLine": "lf", | ||
"outDir": "dist", | ||
@@ -20,4 +21,5 @@ "rootDir": "src", | ||
"node_modules", | ||
"dist" | ||
"dist", | ||
"test" | ||
] | ||
} |
41232
10
706
10