@js-utils-kit/valid 1.1.0 → 1.2.0

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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- let e=require(`@js-utils-kit/types`);function t(e){return/[\p{P}]$/u.test(e)}function n(e){return/\s/.test(e)}function r(e){return/^[a-zA-Z]+$/.test(e)}function i(e){return e!=null}function a(e){return i(e)&&Array.isArray(e)}function o(){return typeof window<`u`&&window.document!==void 0}function s(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function c(){return process.env.NODE_ENV===e.Environment.DEV}function l(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);if(e.length>254)return!1;let t=e.split(`@`);if(t.length!==2)return!1;let[n,r]=t;return n.length===0||n.length>64||r.length===0||r.length>255?!1:!(!/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*$/.test(n)||!/^(?!.*\.\.)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/.test(r))}function u(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).length===0:!1}function d(e){return typeof e==`object`&&!!e&&Object.keys(e).length===0&&!a(e)}function f(e){return!e}function p(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}function m(e){return/^[a-z]+$/.test(e)}function h(){return typeof process<`u`&&process.versions!==null&&process.versions.node!==null}function g(e){return typeof e==`object`&&!!e&&Object.keys(e).length>0&&!a(e)}function _(e){return e!=null&&typeof e==`string`}function v(e,t=!0){return _(e)?typeof e==`string`&&(t?e.trim().length>0:e.length>0):!1}function y(e){return!isNaN(Number(e))&&!isNaN(parseFloat(e))}function b(e){return i(e)&&typeof e==`object`&&!a(e)&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function S(){return process.env.NODE_ENV===e.Environment.PROD}function C(e){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(e)}function w(){return process.env.NODE_ENV===e.Environment.TEST}function T(e){return!!e}function E(e){return e==null}function D(e){return/^[A-Z]+$/.test(e)}function O(e){try{return new URL(e),!0}catch{return!1}}function k(e){return/^[A-Z]/.test(e)}exports.endsWithPunctuation=t,exports.hasWhitespace=n,exports.isAlphabetic=r,exports.isArray=a,exports.isBrowser=o,exports.isCamelCase=s,exports.isDefined=i,exports.isDev=c,exports.isEmail=l,exports.isEmpty=u,exports.isEmptyObject=d,exports.isFalsy=f,exports.isKebabCase=p,exports.isLowerCase=m,exports.isNode=h,exports.isNonEmptyObject=g,exports.isNonEmptyString=v,exports.isNumericString=y,exports.isObject=b,exports.isPascalCase=x,exports.isProd=S,exports.isSnakeCase=C,exports.isString=_,exports.isTest=w,exports.isTruthy=T,exports.isURL=O,exports.isUndefinedOrNull=E,exports.isUpperCase=D,exports.startsWithUppercase=k,Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
1
+ let e=require(`@js-utils-kit/types`);function t(e){return/[\p{P}]$/u.test(e)}function n(e){return/\s/.test(e)}function r(e){return/^[a-zA-Z]+$/.test(e)}function i(e){return e!=null}function a(e){return i(e)&&Array.isArray(e)}function o(){return typeof window<`u`&&window.document!==void 0}function s(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function c(){return process.env.NODE_ENV===e.Environment.DEV}function l(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);if(e.length>254)return!1;let t=e.split(`@`);if(t.length!==2)return!1;let[n,r]=t;return n.length===0||n.length>64||r.length===0||r.length>255?!1:!(!/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*$/.test(n)||!/^(?!.*\.\.)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/.test(r))}function u(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).length===0:!1}function d(e){return typeof e==`object`&&!!e&&Object.keys(e).length===0&&!a(e)}function f(e){return!e}function p(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}function m(e){return/^[a-z]+$/.test(e)}function h(){return typeof process<`u`&&process.versions!==null&&process.versions.node!==null}function g(e){return typeof e==`object`&&!!e&&Object.keys(e).length>0&&!a(e)}function _(e){return e!=null&&typeof e==`string`}function v(e,t=!0){return _(e)?typeof e==`string`&&(t?e.trim().length>0:e.length>0):!1}function y(e){return!isNaN(Number(e))&&!isNaN(parseFloat(e))}function b(e){return i(e)&&typeof e==`object`&&!a(e)&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function S(){return process.env.NODE_ENV===e.Environment.PROD}function C(e){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(e)}function w(){return process.env.NODE_ENV===e.Environment.TEST}function T(e){return!!e}function E(e){return e==null}function D(e){return/^[A-Z]+$/.test(e)}function O(e){try{return new URL(e),!0}catch{return!1}}function k(e){return/^[A-Z]/.test(e)}exports.endsWithPunctuation=t,exports.hasWhitespace=n,exports.isAlphabetic=r,exports.isArray=a,exports.isBrowser=o,exports.isCamelCase=s,exports.isDefined=i,exports.isDev=c,exports.isEmail=l,exports.isEmpty=u,exports.isEmptyObject=d,exports.isFalsy=f,exports.isKebabCase=p,exports.isLowerCase=m,exports.isNode=h,exports.isNonEmptyObject=g,exports.isNonEmptyString=v,exports.isNumericString=y,exports.isObject=b,exports.isPascalCase=x,exports.isProd=S,exports.isSnakeCase=C,exports.isString=_,exports.isTest=w,exports.isTruthy=T,exports.isURL=O,exports.isUndefinedOrNull=E,exports.isUpperCase=D,exports.startsWithUppercase=k;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,4 @@
1
- export * from "@js-utils-kit/types";
2
-
3
1
  //#region src/endsWithPunctuation.d.ts
4
-
5
2
  /**
6
3
  * Checks if a string ends with any Unicode punctuation character.
7
4
  *
@@ -14,8 +11,7 @@ export * from "@js-utils-kit/types";
14
11
  * endsWithPunctuation("Okay") // false
15
12
  * ```
16
13
  */
17
- declare function endsWithPunctuation(/** The string to check */
18
- value: string): boolean;
14
+ declare function endsWithPunctuation(/** The string to check */value: string): boolean;
19
15
  //#endregion
20
16
  //#region src/hasWhitespace.d.ts
21
17
  /**
@@ -29,8 +25,7 @@ value: string): boolean;
29
25
  * hasWhitespace("Nowordspace") // false
30
26
  * ```
31
27
  */
32
- declare function hasWhitespace(/** The string to check */
33
- value: string): boolean;
28
+ declare function hasWhitespace(/** The string to check */value: string): boolean;
34
29
  //#endregion
35
30
  //#region src/isAlphabetic.d.ts
36
31
  /**
@@ -46,6 +41,7 @@ value: string): boolean;
46
41
  * ```
47
42
  */
48
43
  declare function isAlphabetic(/** The string to check */
44
+
49
45
  value: string): boolean;
50
46
  //#endregion
51
47
  //#region src/isArray.d.ts
@@ -65,6 +61,7 @@ value: string): boolean;
65
61
  * ```
66
62
  */
67
63
  declare function isArray<T>(/** The value to check */
64
+
68
65
  value: T): boolean;
69
66
  //#endregion
70
67
  //#region src/isBrowser.d.ts
@@ -98,6 +95,7 @@ declare function isBrowser(): boolean;
98
95
  * ```
99
96
  */
100
97
  declare function isCamelCase(/** The input string */
98
+
101
99
  value: string): boolean;
102
100
  //#endregion
103
101
  //#region src/isDefined.d.ts
@@ -115,6 +113,7 @@ value: string): boolean;
115
113
  * ```
116
114
  */
117
115
  declare function isDefined<T>(/** The value to check */
116
+
118
117
  value: T): boolean;
119
118
  //#endregion
120
119
  //#region src/isDev.d.ts
@@ -162,6 +161,7 @@ declare function isDev(): boolean;
162
161
  * ```
163
162
  */
164
163
  declare function isEmail(/** The string to validate as an email address */
164
+
165
165
  value: string): boolean;
166
166
  //#endregion
167
167
  //#region src/isEmpty.d.ts
@@ -198,6 +198,7 @@ declare function isEmpty<T>(
198
198
  /**
199
199
  * The value to check.
200
200
  */
201
+
201
202
  value: T): boolean;
202
203
  //#endregion
203
204
  //#region src/isEmptyObject.d.ts
@@ -215,6 +216,7 @@ value: T): boolean;
215
216
  * ```
216
217
  */
217
218
  declare function isEmptyObject(/** The value to check */
219
+
218
220
  value: object): boolean;
219
221
  //#endregion
220
222
  //#region src/isFalsy.d.ts
@@ -252,6 +254,7 @@ declare function isFalsy<T>(
252
254
  /**
253
255
  * The value to check.
254
256
  */
257
+
255
258
  value: T): boolean;
256
259
  //#endregion
257
260
  //#region src/isKebabCase.d.ts
@@ -267,6 +270,7 @@ value: T): boolean;
267
270
  * ```
268
271
  */
269
272
  declare function isKebabCase(/** The input string */
273
+
270
274
  value: string): boolean;
271
275
  //#endregion
272
276
  //#region src/isLowerCase.d.ts
@@ -282,6 +286,7 @@ value: string): boolean;
282
286
  * ```
283
287
  */
284
288
  declare function isLowerCase(/** The input string */
289
+
285
290
  value: string): boolean;
286
291
  //#endregion
287
292
  //#region src/isNode.d.ts
@@ -320,6 +325,7 @@ declare function isNode(): boolean;
320
325
  * ```
321
326
  */
322
327
  declare function isNonEmptyObject(/** The value to check */
328
+
323
329
  value: object): boolean;
324
330
  //#endregion
325
331
  //#region src/isNonEmptyString.d.ts
@@ -348,12 +354,14 @@ value: object): boolean;
348
354
  * ```
349
355
  */
350
356
  declare function isNonEmptyString<T>(/** The value to validate as a non-empty string */
357
+
351
358
  value: T,
352
359
  /**
353
360
  * Whether to trim whitespace from the string before checking its length.
354
361
  *
355
362
  * @default true
356
363
  */
364
+
357
365
  trim?: boolean): boolean;
358
366
  //#endregion
359
367
  //#region src/isNumericString.d.ts
@@ -386,6 +394,7 @@ trim?: boolean): boolean;
386
394
  * - {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN isNaN()}
387
395
  */
388
396
  declare function isNumericString(/** The string to validate */
397
+
389
398
  value: string): boolean;
390
399
  //#endregion
391
400
  //#region src/isObject.d.ts
@@ -403,6 +412,7 @@ value: string): boolean;
403
412
  * ```
404
413
  */
405
414
  declare function isObject<T>(/** The value to check */
415
+
406
416
  value: T): boolean;
407
417
  //#endregion
408
418
  //#region src/isPascalCase.d.ts
@@ -418,6 +428,7 @@ value: T): boolean;
418
428
  * ```
419
429
  */
420
430
  declare function isPascalCase(/** The input string */
431
+
421
432
  value: string): boolean;
422
433
  //#endregion
423
434
  //#region src/isProd.d.ts
@@ -450,6 +461,7 @@ declare function isProd(): boolean;
450
461
  * ```
451
462
  */
452
463
  declare function isSnakeCase(/** The input string */
464
+
453
465
  value: string): boolean;
454
466
  //#endregion
455
467
  //#region src/isString.d.ts
@@ -478,6 +490,7 @@ value: string): boolean;
478
490
  * ```
479
491
  */
480
492
  declare function isString<T>(/** The value to be checked */
493
+
481
494
  value: T): boolean;
482
495
  //#endregion
483
496
  //#region src/isTest.d.ts
@@ -532,6 +545,7 @@ declare function isTruthy<T>(
532
545
  /**
533
546
  * The value to check.
534
547
  */
548
+
535
549
  value: T): boolean;
536
550
  //#endregion
537
551
  //#region src/isUndefinedOrNull.d.ts
@@ -549,6 +563,7 @@ value: T): boolean;
549
563
  * ```
550
564
  */
551
565
  declare function isUndefinedOrNull<T>(/** The value to check */
566
+
552
567
  value: T): boolean;
553
568
  //#endregion
554
569
  //#region src/isUpperCase.d.ts
@@ -564,6 +579,7 @@ value: T): boolean;
564
579
  * ```
565
580
  */
566
581
  declare function isUpperCase(/** The input string */
582
+
567
583
  value: string): boolean;
568
584
  //#endregion
569
585
  //#region src/isURL.d.ts
@@ -584,6 +600,7 @@ value: string): boolean;
584
600
  * ```
585
601
  */
586
602
  declare function isURL(/** The string to validate as a URL */
603
+
587
604
  value: string): boolean;
588
605
  //#endregion
589
606
  //#region src/startsWithUppercase.d.ts
@@ -599,6 +616,7 @@ value: string): boolean;
599
616
  * ```
600
617
  */
601
618
  declare function startsWithUppercase(/** The input string to check */
619
+
602
620
  value: string): boolean;
603
621
  //#endregion
604
622
  export { endsWithPunctuation, hasWhitespace, isAlphabetic, isArray, isBrowser, isCamelCase, isDefined, isDev, isEmail, isEmpty, isEmptyObject, isFalsy, isKebabCase, isLowerCase, isNode, isNonEmptyObject, isNonEmptyString, isNumericString, isObject, isPascalCase, isProd, isSnakeCase, isString, isTest, isTruthy, isURL, isUndefinedOrNull, isUpperCase, startsWithUppercase };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,4 @@
1
- export * from "@js-utils-kit/types";
2
-
3
1
  //#region src/endsWithPunctuation.d.ts
4
-
5
2
  /**
6
3
  * Checks if a string ends with any Unicode punctuation character.
7
4
  *
@@ -14,8 +11,7 @@ export * from "@js-utils-kit/types";
14
11
  * endsWithPunctuation("Okay") // false
15
12
  * ```
16
13
  */
17
- declare function endsWithPunctuation(/** The string to check */
18
- value: string): boolean;
14
+ declare function endsWithPunctuation(/** The string to check */value: string): boolean;
19
15
  //#endregion
20
16
  //#region src/hasWhitespace.d.ts
21
17
  /**
@@ -29,8 +25,7 @@ value: string): boolean;
29
25
  * hasWhitespace("Nowordspace") // false
30
26
  * ```
31
27
  */
32
- declare function hasWhitespace(/** The string to check */
33
- value: string): boolean;
28
+ declare function hasWhitespace(/** The string to check */value: string): boolean;
34
29
  //#endregion
35
30
  //#region src/isAlphabetic.d.ts
36
31
  /**
@@ -46,6 +41,7 @@ value: string): boolean;
46
41
  * ```
47
42
  */
48
43
  declare function isAlphabetic(/** The string to check */
44
+
49
45
  value: string): boolean;
50
46
  //#endregion
51
47
  //#region src/isArray.d.ts
@@ -65,6 +61,7 @@ value: string): boolean;
65
61
  * ```
66
62
  */
67
63
  declare function isArray<T>(/** The value to check */
64
+
68
65
  value: T): boolean;
69
66
  //#endregion
70
67
  //#region src/isBrowser.d.ts
@@ -98,6 +95,7 @@ declare function isBrowser(): boolean;
98
95
  * ```
99
96
  */
100
97
  declare function isCamelCase(/** The input string */
98
+
101
99
  value: string): boolean;
102
100
  //#endregion
103
101
  //#region src/isDefined.d.ts
@@ -115,6 +113,7 @@ value: string): boolean;
115
113
  * ```
116
114
  */
117
115
  declare function isDefined<T>(/** The value to check */
116
+
118
117
  value: T): boolean;
119
118
  //#endregion
120
119
  //#region src/isDev.d.ts
@@ -162,6 +161,7 @@ declare function isDev(): boolean;
162
161
  * ```
163
162
  */
164
163
  declare function isEmail(/** The string to validate as an email address */
164
+
165
165
  value: string): boolean;
166
166
  //#endregion
167
167
  //#region src/isEmpty.d.ts
@@ -198,6 +198,7 @@ declare function isEmpty<T>(
198
198
  /**
199
199
  * The value to check.
200
200
  */
201
+
201
202
  value: T): boolean;
202
203
  //#endregion
203
204
  //#region src/isEmptyObject.d.ts
@@ -215,6 +216,7 @@ value: T): boolean;
215
216
  * ```
216
217
  */
217
218
  declare function isEmptyObject(/** The value to check */
219
+
218
220
  value: object): boolean;
219
221
  //#endregion
220
222
  //#region src/isFalsy.d.ts
@@ -252,6 +254,7 @@ declare function isFalsy<T>(
252
254
  /**
253
255
  * The value to check.
254
256
  */
257
+
255
258
  value: T): boolean;
256
259
  //#endregion
257
260
  //#region src/isKebabCase.d.ts
@@ -267,6 +270,7 @@ value: T): boolean;
267
270
  * ```
268
271
  */
269
272
  declare function isKebabCase(/** The input string */
273
+
270
274
  value: string): boolean;
271
275
  //#endregion
272
276
  //#region src/isLowerCase.d.ts
@@ -282,6 +286,7 @@ value: string): boolean;
282
286
  * ```
283
287
  */
284
288
  declare function isLowerCase(/** The input string */
289
+
285
290
  value: string): boolean;
286
291
  //#endregion
287
292
  //#region src/isNode.d.ts
@@ -320,6 +325,7 @@ declare function isNode(): boolean;
320
325
  * ```
321
326
  */
322
327
  declare function isNonEmptyObject(/** The value to check */
328
+
323
329
  value: object): boolean;
324
330
  //#endregion
325
331
  //#region src/isNonEmptyString.d.ts
@@ -348,12 +354,14 @@ value: object): boolean;
348
354
  * ```
349
355
  */
350
356
  declare function isNonEmptyString<T>(/** The value to validate as a non-empty string */
357
+
351
358
  value: T,
352
359
  /**
353
360
  * Whether to trim whitespace from the string before checking its length.
354
361
  *
355
362
  * @default true
356
363
  */
364
+
357
365
  trim?: boolean): boolean;
358
366
  //#endregion
359
367
  //#region src/isNumericString.d.ts
@@ -386,6 +394,7 @@ trim?: boolean): boolean;
386
394
  * - {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN isNaN()}
387
395
  */
388
396
  declare function isNumericString(/** The string to validate */
397
+
389
398
  value: string): boolean;
390
399
  //#endregion
391
400
  //#region src/isObject.d.ts
@@ -403,6 +412,7 @@ value: string): boolean;
403
412
  * ```
404
413
  */
405
414
  declare function isObject<T>(/** The value to check */
415
+
406
416
  value: T): boolean;
407
417
  //#endregion
408
418
  //#region src/isPascalCase.d.ts
@@ -418,6 +428,7 @@ value: T): boolean;
418
428
  * ```
419
429
  */
420
430
  declare function isPascalCase(/** The input string */
431
+
421
432
  value: string): boolean;
422
433
  //#endregion
423
434
  //#region src/isProd.d.ts
@@ -450,6 +461,7 @@ declare function isProd(): boolean;
450
461
  * ```
451
462
  */
452
463
  declare function isSnakeCase(/** The input string */
464
+
453
465
  value: string): boolean;
454
466
  //#endregion
455
467
  //#region src/isString.d.ts
@@ -478,6 +490,7 @@ value: string): boolean;
478
490
  * ```
479
491
  */
480
492
  declare function isString<T>(/** The value to be checked */
493
+
481
494
  value: T): boolean;
482
495
  //#endregion
483
496
  //#region src/isTest.d.ts
@@ -532,6 +545,7 @@ declare function isTruthy<T>(
532
545
  /**
533
546
  * The value to check.
534
547
  */
548
+
535
549
  value: T): boolean;
536
550
  //#endregion
537
551
  //#region src/isUndefinedOrNull.d.ts
@@ -549,6 +563,7 @@ value: T): boolean;
549
563
  * ```
550
564
  */
551
565
  declare function isUndefinedOrNull<T>(/** The value to check */
566
+
552
567
  value: T): boolean;
553
568
  //#endregion
554
569
  //#region src/isUpperCase.d.ts
@@ -564,6 +579,7 @@ value: T): boolean;
564
579
  * ```
565
580
  */
566
581
  declare function isUpperCase(/** The input string */
582
+
567
583
  value: string): boolean;
568
584
  //#endregion
569
585
  //#region src/isURL.d.ts
@@ -584,6 +600,7 @@ value: string): boolean;
584
600
  * ```
585
601
  */
586
602
  declare function isURL(/** The string to validate as a URL */
603
+
587
604
  value: string): boolean;
588
605
  //#endregion
589
606
  //#region src/startsWithUppercase.d.ts
@@ -599,6 +616,7 @@ value: string): boolean;
599
616
  * ```
600
617
  */
601
618
  declare function startsWithUppercase(/** The input string to check */
619
+
602
620
  value: string): boolean;
603
621
  //#endregion
604
622
  export { endsWithPunctuation, hasWhitespace, isAlphabetic, isArray, isBrowser, isCamelCase, isDefined, isDev, isEmail, isEmpty, isEmptyObject, isFalsy, isKebabCase, isLowerCase, isNode, isNonEmptyObject, isNonEmptyString, isNumericString, isObject, isPascalCase, isProd, isSnakeCase, isString, isTest, isTruthy, isURL, isUndefinedOrNull, isUpperCase, startsWithUppercase };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{Environment as e}from"@js-utils-kit/types";export*from"@js-utils-kit/types";function t(e){return/[\p{P}]$/u.test(e)}function n(e){return/\s/.test(e)}function r(e){return/^[a-zA-Z]+$/.test(e)}function i(e){return e!=null}function a(e){return i(e)&&Array.isArray(e)}function o(){return typeof window<`u`&&window.document!==void 0}function s(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function c(){return process.env.NODE_ENV===e.DEV}function l(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);if(e.length>254)return!1;let t=e.split(`@`);if(t.length!==2)return!1;let[n,r]=t;return n.length===0||n.length>64||r.length===0||r.length>255?!1:!(!/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*$/.test(n)||!/^(?!.*\.\.)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/.test(r))}function u(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).length===0:!1}function d(e){return typeof e==`object`&&!!e&&Object.keys(e).length===0&&!a(e)}function f(e){return!e}function p(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}function m(e){return/^[a-z]+$/.test(e)}function h(){return typeof process<`u`&&process.versions!==null&&process.versions.node!==null}function g(e){return typeof e==`object`&&!!e&&Object.keys(e).length>0&&!a(e)}function _(e){return e!=null&&typeof e==`string`}function v(e,t=!0){return _(e)?typeof e==`string`&&(t?e.trim().length>0:e.length>0):!1}function y(e){return!isNaN(Number(e))&&!isNaN(parseFloat(e))}function b(e){return i(e)&&typeof e==`object`&&!a(e)&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function S(){return process.env.NODE_ENV===e.PROD}function C(e){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(e)}function w(){return process.env.NODE_ENV===e.TEST}function T(e){return!!e}function E(e){return e==null}function D(e){return/^[A-Z]+$/.test(e)}function O(e){try{return new URL(e),!0}catch{return!1}}function k(e){return/^[A-Z]/.test(e)}export{t as endsWithPunctuation,n as hasWhitespace,r as isAlphabetic,a as isArray,o as isBrowser,s as isCamelCase,i as isDefined,c as isDev,l as isEmail,u as isEmpty,d as isEmptyObject,f as isFalsy,p as isKebabCase,m as isLowerCase,h as isNode,g as isNonEmptyObject,v as isNonEmptyString,y as isNumericString,b as isObject,x as isPascalCase,S as isProd,C as isSnakeCase,_ as isString,w as isTest,T as isTruthy,O as isURL,E as isUndefinedOrNull,D as isUpperCase,k as startsWithUppercase};
1
+ import{Environment as e}from"@js-utils-kit/types";function t(e){return/[\p{P}]$/u.test(e)}function n(e){return/\s/.test(e)}function r(e){return/^[a-zA-Z]+$/.test(e)}function i(e){return e!=null}function a(e){return i(e)&&Array.isArray(e)}function o(){return typeof window<`u`&&window.document!==void 0}function s(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function c(){return process.env.NODE_ENV===e.DEV}function l(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);if(e.length>254)return!1;let t=e.split(`@`);if(t.length!==2)return!1;let[n,r]=t;return n.length===0||n.length>64||r.length===0||r.length>255?!1:!(!/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*$/.test(n)||!/^(?!.*\.\.)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*\.[A-Za-z]{2,}$/.test(r))}function u(e){return e==null?!0:typeof e==`string`?e.trim().length===0:Array.isArray(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).length===0:!1}function d(e){return typeof e==`object`&&!!e&&Object.keys(e).length===0&&!a(e)}function f(e){return!e}function p(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}function m(e){return/^[a-z]+$/.test(e)}function h(){return typeof process<`u`&&process.versions!==null&&process.versions.node!==null}function g(e){return typeof e==`object`&&!!e&&Object.keys(e).length>0&&!a(e)}function _(e){return e!=null&&typeof e==`string`}function v(e,t=!0){return _(e)?typeof e==`string`&&(t?e.trim().length>0:e.length>0):!1}function y(e){return!isNaN(Number(e))&&!isNaN(parseFloat(e))}function b(e){return i(e)&&typeof e==`object`&&!a(e)&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function S(){return process.env.NODE_ENV===e.PROD}function C(e){return/^[a-z0-9]+(_[a-z0-9]+)*$/.test(e)}function w(){return process.env.NODE_ENV===e.TEST}function T(e){return!!e}function E(e){return e==null}function D(e){return/^[A-Z]+$/.test(e)}function O(e){try{return new URL(e),!0}catch{return!1}}function k(e){return/^[A-Z]/.test(e)}export{t as endsWithPunctuation,n as hasWhitespace,r as isAlphabetic,a as isArray,o as isBrowser,s as isCamelCase,i as isDefined,c as isDev,l as isEmail,u as isEmpty,d as isEmptyObject,f as isFalsy,p as isKebabCase,m as isLowerCase,h as isNode,g as isNonEmptyObject,v as isNonEmptyString,y as isNumericString,b as isObject,x as isPascalCase,S as isProd,C as isSnakeCase,_ as isString,w as isTest,T as isTruthy,O as isURL,E as isUndefinedOrNull,D as isUpperCase,k as startsWithUppercase};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-utils-kit/valid",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Validation utilities",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -41,7 +41,7 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@js-utils-kit/types": "1.1.0"
44
+ "@js-utils-kit/types": "1.2.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsdown",