generated from gxc-solutions/gxc-template-repo
Added type for uuidv4
This commit is contained in:
parent
aad2fe13e7
commit
0d1df855a3
2 changed files with 4 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@gxc-solutions/lett-js",
|
"name": "@gxc-solutions/lett-js",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "GXC Solutions",
|
"author": "GXC Solutions",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
export const uuidv4 = () => {
|
export type UUID_V4 = `${string}-${string}-${string}-${string}-${string}`;
|
||||||
|
|
||||||
|
export const uuidv4 = (): UUID_V4 => {
|
||||||
if (crypto.randomUUID == null) {
|
if (crypto.randomUUID == null) {
|
||||||
"10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) =>
|
"10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) =>
|
||||||
// eslint-disable-next-line no-bitwise
|
// eslint-disable-next-line no-bitwise
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue