asma-helpers 0.37.21 → 0.37.22
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/lib/helpers/isUUID.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ import type { IUUID } from 'asma-types/lib';
|
|
|
9
9
|
* isUUID('00000000-0000-0000-0000-000000000000') // true
|
|
10
10
|
* isUUID('use_strict')('00000000-0000-0000-0000-000000000000') // false (strict)
|
|
11
11
|
*/
|
|
12
|
-
export declare function isUUID(string
|
|
13
|
-
export declare function isUUID(mode: 'use_strict'): (string
|
|
12
|
+
export declare function isUUID(string?: string): string is IUUID;
|
|
13
|
+
export declare function isUUID(mode: 'use_strict'): (string?: string) => string is IUUID;
|
|
14
14
|
//# sourceMappingURL=isUUID.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUUID.d.ts","sourceRoot":"","sources":["../../src/helpers/isUUID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAK3C;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"isUUID.d.ts","sourceRoot":"","sources":["../../src/helpers/isUUID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAK3C;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,KAAK,CAAA;AACxD,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,IAAI,KAAK,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUUID.js","sourceRoot":"","sources":["../../src/helpers/isUUID.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAW,4EAA4E,CAAA;AAC9G,MAAM,eAAe,GAAW,iEAAiE,CAAA;AAcjG,MAAM,UAAU,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"isUUID.js","sourceRoot":"","sources":["../../src/helpers/isUUID.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAW,4EAA4E,CAAA;AAC9G,MAAM,eAAe,GAAW,iEAAiE,CAAA;AAcjG,MAAM,UAAU,MAAM,CAAC,KAA6B;IAChD,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;QACzB,OAAO,CAAC,MAAc,EAAmB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IACrF,CAAC;IAED,OAAO,UAAU,CAAC,KAAK,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,UAAU,CAAC,MAAe,EAAE,aAAqB,eAAe;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACzB,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAClC,CAAC"}
|
package/package.json
CHANGED
package/src/helpers/isUUID.ts
CHANGED
|
@@ -13,9 +13,9 @@ const ASMA_UUID_REGEX: RegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4
|
|
|
13
13
|
* isUUID('00000000-0000-0000-0000-000000000000') // true
|
|
14
14
|
* isUUID('use_strict')('00000000-0000-0000-0000-000000000000') // false (strict)
|
|
15
15
|
*/
|
|
16
|
-
export function isUUID(string
|
|
17
|
-
export function isUUID(mode: 'use_strict'): (string
|
|
18
|
-
export function isUUID(param
|
|
16
|
+
export function isUUID(string?: string): string is IUUID
|
|
17
|
+
export function isUUID(mode: 'use_strict'): (string?: string) => string is IUUID
|
|
18
|
+
export function isUUID(param?: 'use_strict' | string) {
|
|
19
19
|
if (param === 'use_strict') {
|
|
20
20
|
return (string: string): string is IUUID => assertUUID(string, STRICT_UUID_REGEX)
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@ export function isUUID(param: 'use_strict' | string) {
|
|
|
23
23
|
return assertUUID(param)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function assertUUID(string
|
|
26
|
+
function assertUUID(string?: string, UUID_REGEX: RegExp = ASMA_UUID_REGEX): string is IUUID {
|
|
27
27
|
if (!string) return false
|
|
28
28
|
return UUID_REGEX.test(string)
|
|
29
29
|
}
|