Commit c37d9e01 authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

UID des objets: meilleure fonction de chaîne aléatoire

Showing with 4 additions and 2 deletions
+4 -2
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
"main": "build/index.js", "main": "build/index.js",
"types": "build/index.d.ts", "types": "build/index.d.ts",
"module": "build/index.js", "module": "build/index.js",
"dependencies": {}, "dependencies": {
"buffer": "^5.2.1"
},
"devDependencies": { "devDependencies": {
"@types/jasmine": "2.8.8", "@types/jasmine": "2.8.8",
"@types/node": "10.5.2", "@types/node": "10.5.2",
......
...@@ -13,7 +13,7 @@ export abstract class JalhydObject implements IJalhydObject { ...@@ -13,7 +13,7 @@ export abstract class JalhydObject implements IJalhydObject {
} }
public static get nextUID(): string { public static get nextUID(): string {
return Math.random().toString(36).substring(2, 8); return Buffer.from(Math.random().toString(36).substring(2)).toString("base64").substring(0, 6);
} }
/** id numérique unique */ /** id numérique unique */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment