@augment-vir/common
Advanced tools
Comparing version 29.2.0 to 29.3.0
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.randomBoolean = randomBoolean; | ||
exports.createUuid = createUuid; | ||
exports.randomString = randomString; | ||
@@ -67,6 +66,2 @@ const common_number_1 = require("./common-number"); | ||
} | ||
/** Creates a cryptographically secure uuid. */ | ||
function createUuid() { | ||
return crypto.randomUUID(); | ||
} | ||
const validStringCharacters = [ | ||
@@ -73,0 +68,0 @@ 'a', |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isUuid = isUuid; | ||
exports.createUuid = createUuid; | ||
const uuidRegExp = /[\d\w]{8}-[\d\w]{4}-[\d\w]{4}-[\d\w]{4}-[\d\w]{12}/; | ||
/** Checks if the input string is a valid v4 UUID. */ | ||
function isUuid(maybeUuid) { | ||
return !!maybeUuid.match(uuidRegExp); | ||
} | ||
/** Creates a cryptographically secure v4 UUID using `crypto.randomUUID`. */ | ||
function createUuid() { | ||
return crypto.randomUUID(); | ||
} |
@@ -60,6 +60,2 @@ import { clamp, ensureMinAndMax } from './common-number'; | ||
} | ||
/** Creates a cryptographically secure uuid. */ | ||
export function createUuid() { | ||
return crypto.randomUUID(); | ||
} | ||
const validStringCharacters = [ | ||
@@ -66,0 +62,0 @@ 'a', |
const uuidRegExp = /[\d\w]{8}-[\d\w]{4}-[\d\w]{4}-[\d\w]{4}-[\d\w]{12}/; | ||
/** Checks if the input string is a valid v4 UUID. */ | ||
export function isUuid(maybeUuid) { | ||
return !!maybeUuid.match(uuidRegExp); | ||
} | ||
/** Creates a cryptographically secure v4 UUID using `crypto.randomUUID`. */ | ||
export function createUuid() { | ||
return crypto.randomUUID(); | ||
} |
@@ -32,4 +32,2 @@ /** | ||
export declare function randomBoolean(percentLikelyToBeTrue?: number): boolean; | ||
/** Creates a cryptographically secure uuid. */ | ||
export declare function createUuid(): `${string}-${string}-${string}-${string}-${string}`; | ||
/** | ||
@@ -36,0 +34,0 @@ * Creates a random string (including letters and numbers) of a given length. |
@@ -0,1 +1,5 @@ | ||
export type UuidV4 = ReturnType<typeof createUuid>; | ||
/** Checks if the input string is a valid v4 UUID. */ | ||
export declare function isUuid(maybeUuid: string): boolean; | ||
/** Creates a cryptographically secure v4 UUID using `crypto.randomUUID`. */ | ||
export declare function createUuid(): `${string}-${string}-${string}-${string}-${string}`; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "29.2.0", | ||
"version": "29.3.0", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -5,0 +5,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167688
4272