itee-validators 5.3.4 → 5.3.6
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/.github/workflows/node.js.yml +1 -1
- package/CHANGELOG.md +34 -0
- package/builds/itee-validators.cjs.js +87 -48
- package/builds/itee-validators.cjs.js.map +1 -1
- package/builds/itee-validators.cjs.min.js +64 -64
- package/builds/itee-validators.esm.js +11 -11
- package/builds/itee-validators.esm.js.map +1 -1
- package/builds/itee-validators.esm.min.js +4 -4
- package/builds/itee-validators.iife.js +11 -11
- package/builds/itee-validators.iife.js.map +1 -1
- package/builds/itee-validators.iife.min.js +4 -4
- package/package.json +28 -24
- package/sources/cores/_cores.js +1 -1
- package/sources/cores/numbers/_numbers.js +2 -0
- package/sources/cores/tests/isTestUnitGenerator.js +118 -0
- package/sources/dom/isEventTarget.js +10 -0
- package/sources/file-system/block-devices/isBlockDevicePath.js +9 -2
- package/sources/file-system/character-devices/isCharacterDevicePath.js +8 -1
- package/sources/file-system/directories/isDirectoryPath.js +8 -1
- package/sources/file-system/directories/isEmptyDirectory.js +2 -1
- package/sources/file-system/fifo-pipes/isFIFOPath.js +8 -1
- package/sources/file-system/files/isEmptyFile.js +9 -3
- package/sources/file-system/files/isFilePath.js +8 -1
- package/sources/file-system/sockets/isSocketPath.js +8 -1
- package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +8 -1
- package/sources/physics/temperatures/isCelsius.js +3 -3
- package/sources/physics/temperatures/isFahrenheit.js +3 -3
- package/sources/physics/temperatures/isKelvin.js +3 -3
- package/sources/physics/temperatures/isTemperature.js +1 -1
|
@@ -153,7 +153,7 @@ function c(t){return null!=t}function p(t){return null==t}
|
|
|
153
153
|
* //...
|
|
154
154
|
* }
|
|
155
155
|
*
|
|
156
|
-
*/function l(t){return!h(t)&&(!Number.isNaN(t)&&!Number.isFinite(t))}function
|
|
156
|
+
*/function l(t){return!h(t)&&(!Number.isNaN(t)&&!Number.isFinite(t))}function y(t){return t===Number.POSITIVE_INFINITY}function x(t){return 0===t&&1/t===Number.POSITIVE_INFINITY}
|
|
157
157
|
/**
|
|
158
158
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
159
159
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -189,7 +189,7 @@ function N(t){return!p(t)&&t.constructor===Number}function h(t){return!N(t)}func
|
|
|
189
189
|
* }
|
|
190
190
|
*
|
|
191
191
|
*/
|
|
192
|
-
function I(t){return!p(t)&&t.constructor===Object}function
|
|
192
|
+
function I(t){return!p(t)&&t.constructor===Object}function E(t){return!I(t)}
|
|
193
193
|
/**
|
|
194
194
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
195
195
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -276,7 +276,7 @@ function b(t){return"string"==typeof t||t instanceof String}function g(t){return
|
|
|
276
276
|
* }
|
|
277
277
|
*
|
|
278
278
|
*/
|
|
279
|
-
function
|
|
279
|
+
function m(t){if(E(t))return!1;if(0===t.length)return!0;for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))return!1;return!0}
|
|
280
280
|
/**
|
|
281
281
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
282
282
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -330,7 +330,7 @@ function F(t){return!g(t)&&(!S(t)&&!/\S/.test(t))}
|
|
|
330
330
|
* }
|
|
331
331
|
*
|
|
332
332
|
*/
|
|
333
|
-
function
|
|
333
|
+
function w(t){return"symbol"==typeof t}
|
|
334
334
|
/**
|
|
335
335
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
336
336
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -348,7 +348,7 @@ function O(t){return"symbol"==typeof t}
|
|
|
348
348
|
* }
|
|
349
349
|
*
|
|
350
350
|
*/
|
|
351
|
-
function
|
|
351
|
+
function O(t){return!p(t)&&(!!S(t)||(!!i(t)||!!m(t)))}
|
|
352
352
|
/**
|
|
353
353
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
354
354
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -474,7 +474,7 @@ function P(t){return!p(t)&&(!!S(t)||(!!i(t)||!!E(t)))}
|
|
|
474
474
|
}
|
|
475
475
|
*
|
|
476
476
|
*/
|
|
477
|
-
class
|
|
477
|
+
class P{constructor(){this.validators={Boolean:o,Number:N,Integer:d,Float:A,Array:n,String:b,Object:I,Symbol:w,Function:s},this.errors=[]}add(t,r){if(g(t))throw new TypeError("Validator: Expect type to be a string");if(f(r)&&E(r))throw new TypeError("Validator: Expect validator to be an object or a function");if(c(this.validators[t]))throw new TypeError(`Validator: a validator is already defined for type '${t}'`);this.validators[t]=r}remove(t){delete this.validators[t]}getAvalaibleTypes(){const t=[];for(let r in this.validators)t.push(r);return t}check(t,r,n=!0){const e=this.validators[r];if(p(e))throw new TypeError(`Validator: Unable to find schema validation of type '${r}'`);let i=!0;if(s(e))i=e(t);else{if(!I(e))throw new TypeError(`Validator: Unknown validator of type '${r}'`);{let o=!0;for(let u in e){const s=e[u];if(p(s))throw new TypeError(`Validator: Missing validator for key '${u}' of type '${r}'`);const a=t[u],l=s.required;if(p(a)){if(!l)continue;o=!1}let y=s.fn;if(c(y)){if(f(y))throw new TypeError(`Validator: Invalid validation function for '${u}' with type '${r}'`);o=y(a)}else o=this.check(a,s.type,n);if(!1===o&&(this.errors.push(`Validator: Invalid property '${u}' of type '${s.type}' with value '${a}' in object of type '${r}'`),i=!1,n))break}}}return i}}
|
|
478
478
|
/**
|
|
479
479
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
480
480
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -492,7 +492,7 @@ class U{constructor(){this.validators={Boolean:o,Number:N,Integer:d,Float:A,Arra
|
|
|
492
492
|
* }
|
|
493
493
|
*
|
|
494
494
|
*/
|
|
495
|
-
function
|
|
495
|
+
function U(t){return t instanceof ArrayBuffer}
|
|
496
496
|
/**
|
|
497
497
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
498
498
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -546,7 +546,7 @@ function B(t){return t instanceof BigUint64Array}
|
|
|
546
546
|
* }
|
|
547
547
|
*
|
|
548
548
|
*/
|
|
549
|
-
function
|
|
549
|
+
function V(t){return t instanceof Float32Array}
|
|
550
550
|
/**
|
|
551
551
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
552
552
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -564,7 +564,7 @@ function k(t){return t instanceof Float32Array}
|
|
|
564
564
|
* }
|
|
565
565
|
*
|
|
566
566
|
*/
|
|
567
|
-
function
|
|
567
|
+
function k(t){return t instanceof Float64Array}
|
|
568
568
|
/**
|
|
569
569
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
570
570
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -582,7 +582,7 @@ function _(t){return t instanceof Float64Array}
|
|
|
582
582
|
* }
|
|
583
583
|
*
|
|
584
584
|
*/
|
|
585
|
-
function
|
|
585
|
+
function L(t){return t instanceof Int16Array}
|
|
586
586
|
/**
|
|
587
587
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
588
588
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -600,7 +600,7 @@ function w(t){return t instanceof Int16Array}
|
|
|
600
600
|
* }
|
|
601
601
|
*
|
|
602
602
|
*/
|
|
603
|
-
function
|
|
603
|
+
function _(t){return t instanceof Int32Array}
|
|
604
604
|
/**
|
|
605
605
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
606
606
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -618,7 +618,7 @@ function D(t){return t instanceof Int32Array}
|
|
|
618
618
|
* }
|
|
619
619
|
*
|
|
620
620
|
*/
|
|
621
|
-
function
|
|
621
|
+
function D(t){return t instanceof Int8Array}
|
|
622
622
|
/**
|
|
623
623
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
624
624
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -636,7 +636,7 @@ function M(t){return t instanceof Int8Array}
|
|
|
636
636
|
* }
|
|
637
637
|
*
|
|
638
638
|
*/
|
|
639
|
-
function
|
|
639
|
+
function M(t){return t instanceof Uint16Array}
|
|
640
640
|
/**
|
|
641
641
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
642
642
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -654,7 +654,7 @@ function L(t){return t instanceof Uint16Array}
|
|
|
654
654
|
* }
|
|
655
655
|
*
|
|
656
656
|
*/
|
|
657
|
-
function
|
|
657
|
+
function R(t){return t instanceof Uint32Array}
|
|
658
658
|
/**
|
|
659
659
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
660
660
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -672,7 +672,7 @@ function j(t){return t instanceof Uint32Array}
|
|
|
672
672
|
* }
|
|
673
673
|
*
|
|
674
674
|
*/
|
|
675
|
-
function
|
|
675
|
+
function j(t){return t instanceof Uint8Array}
|
|
676
676
|
/**
|
|
677
677
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
678
678
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -690,12 +690,12 @@ function C(t){return t instanceof Uint8Array}
|
|
|
690
690
|
* }
|
|
691
691
|
*
|
|
692
692
|
*/
|
|
693
|
-
function
|
|
693
|
+
function C(t){return t instanceof Uint8ClampedArray}exports.Validator=void 0,p(exports.Validator)&&(exports.Validator=new P);
|
|
694
694
|
/**
|
|
695
695
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
696
696
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
697
697
|
*
|
|
698
|
-
* @module sources/physics/
|
|
698
|
+
* @module sources/physics/temperatures
|
|
699
699
|
* @desc Export function to validate if a value is a Celsius temperature
|
|
700
700
|
* @example
|
|
701
701
|
*
|
|
@@ -708,12 +708,12 @@ function $(t){return t instanceof Uint8ClampedArray}exports.Validator=void 0,p(e
|
|
|
708
708
|
* }
|
|
709
709
|
*
|
|
710
710
|
*/
|
|
711
|
-
function
|
|
711
|
+
function $(t){return N(t)&&t>=-273.14999999955}function Z(t){return!$(t)}
|
|
712
712
|
/**
|
|
713
713
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
714
714
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
715
715
|
*
|
|
716
|
-
* @module sources/physics/
|
|
716
|
+
* @module sources/physics/temperatures
|
|
717
717
|
* @desc Export function to validate if a value is a Fahrenheit temperature
|
|
718
718
|
* @example
|
|
719
719
|
*
|
|
@@ -730,7 +730,7 @@ function R(t){return N(t)&&t>=-273.14999999955}function Z(t){return!R(t)}
|
|
|
730
730
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
731
731
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
732
732
|
*
|
|
733
|
-
* @module sources/physics/
|
|
733
|
+
* @module sources/physics/temperatures
|
|
734
734
|
* @desc Export function to validate if a value is a kelvin temperature
|
|
735
735
|
* @example
|
|
736
736
|
*
|
|
@@ -747,7 +747,7 @@ function R(t){return N(t)&&t>=-273.14999999955}function Z(t){return!R(t)}
|
|
|
747
747
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
748
748
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
749
749
|
*
|
|
750
|
-
* @module sources/physics/
|
|
750
|
+
* @module sources/physics/temperatures
|
|
751
751
|
* @desc Export function to validate if a value is a temperature
|
|
752
752
|
* @example
|
|
753
753
|
*
|
|
@@ -780,7 +780,7 @@ function R(t){return N(t)&&t>=-273.14999999955}function Z(t){return!R(t)}
|
|
|
780
780
|
* }
|
|
781
781
|
*
|
|
782
782
|
*/
|
|
783
|
-
function q(t){
|
|
783
|
+
function q(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isBlockDevice()}
|
|
784
784
|
/**
|
|
785
785
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
786
786
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -801,7 +801,7 @@ function q(t){return r.default.statSync(t).isBlockDevice()}
|
|
|
801
801
|
* }
|
|
802
802
|
*
|
|
803
803
|
*/
|
|
804
|
-
function
|
|
804
|
+
function H(t){return r.default.existsSync(t)}
|
|
805
805
|
/**
|
|
806
806
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
807
807
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -819,7 +819,7 @@ function z(t){return r.default.existsSync(t)}
|
|
|
819
819
|
* }
|
|
820
820
|
*
|
|
821
821
|
*/
|
|
822
|
-
function
|
|
822
|
+
function z(t){return H(t)&&q(t)}
|
|
823
823
|
/**
|
|
824
824
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
825
825
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -840,7 +840,7 @@ function H(t){return z(t)&&q(t)}
|
|
|
840
840
|
* }
|
|
841
841
|
*
|
|
842
842
|
*/
|
|
843
|
-
function J(t){
|
|
843
|
+
function J(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isCharacterDevice()}
|
|
844
844
|
/**
|
|
845
845
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
846
846
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -858,7 +858,7 @@ function J(t){return r.default.statSync(t).isCharacterDevice()}
|
|
|
858
858
|
* }
|
|
859
859
|
*
|
|
860
860
|
*/
|
|
861
|
-
function Q(t){return
|
|
861
|
+
function Q(t){return H(t)&&J(t)}
|
|
862
862
|
/**
|
|
863
863
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
864
864
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -879,7 +879,7 @@ function Q(t){return z(t)&&J(t)}
|
|
|
879
879
|
* }
|
|
880
880
|
*
|
|
881
881
|
*/
|
|
882
|
-
function W(t){
|
|
882
|
+
function W(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isDirectory()}
|
|
883
883
|
/**
|
|
884
884
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
885
885
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -900,7 +900,7 @@ function W(t){return r.default.statSync(t).isDirectory()}
|
|
|
900
900
|
* }
|
|
901
901
|
*
|
|
902
902
|
*/
|
|
903
|
-
function tt(t){return 0===r.default.readdirSync(t).length}
|
|
903
|
+
function tt(t){return W(t)&&0===r.default.readdirSync(t).length}
|
|
904
904
|
/**
|
|
905
905
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
906
906
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -918,7 +918,7 @@ function tt(t){return 0===r.default.readdirSync(t).length}
|
|
|
918
918
|
* }
|
|
919
919
|
*
|
|
920
920
|
*/
|
|
921
|
-
function rt(t){return
|
|
921
|
+
function rt(t){return H(t)&&W(t)}
|
|
922
922
|
/**
|
|
923
923
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
924
924
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -939,7 +939,7 @@ function rt(t){return z(t)&&W(t)}
|
|
|
939
939
|
* }
|
|
940
940
|
*
|
|
941
941
|
*/
|
|
942
|
-
function nt(t){
|
|
942
|
+
function nt(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isFIFO()}
|
|
943
943
|
/**
|
|
944
944
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
945
945
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -960,7 +960,7 @@ function nt(t){return r.default.statSync(t).isFIFO()}
|
|
|
960
960
|
* }
|
|
961
961
|
*
|
|
962
962
|
*/
|
|
963
|
-
function et(t){return
|
|
963
|
+
function et(t){return H(t)&&nt(t)}
|
|
964
964
|
/**
|
|
965
965
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
966
966
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -981,7 +981,28 @@ function et(t){return z(t)&&nt(t)}
|
|
|
981
981
|
* }
|
|
982
982
|
*
|
|
983
983
|
*/
|
|
984
|
-
function it(t){
|
|
984
|
+
function it(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isFile()}
|
|
985
|
+
/**
|
|
986
|
+
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
987
|
+
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
988
|
+
*
|
|
989
|
+
* @module sources/file-system/files/isEmptyFile
|
|
990
|
+
* @description Export function to validate if a value is an empty file
|
|
991
|
+
*
|
|
992
|
+
* @requires {@link module: [fs]{@link https://nodejs.org/api/fs.html}}
|
|
993
|
+
*
|
|
994
|
+
* @example
|
|
995
|
+
*
|
|
996
|
+
* import { isEmptyFile } from 'itee-validators'
|
|
997
|
+
*
|
|
998
|
+
* if( isEmptyFile( value ) ) {
|
|
999
|
+
* //...
|
|
1000
|
+
* } else {
|
|
1001
|
+
* //...
|
|
1002
|
+
* }
|
|
1003
|
+
*
|
|
1004
|
+
*/
|
|
1005
|
+
function ot(t,n=0){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");return it(t)&&r.default.statSync(t).size<=n}
|
|
985
1006
|
/**
|
|
986
1007
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
987
1008
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -999,7 +1020,7 @@ function it(t){return r.default.statSync(t).isFile()}
|
|
|
999
1020
|
* }
|
|
1000
1021
|
*
|
|
1001
1022
|
*/
|
|
1002
|
-
function
|
|
1023
|
+
function ut(t){return H(t)&&it(t)}
|
|
1003
1024
|
/**
|
|
1004
1025
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1005
1026
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1020,7 +1041,7 @@ function ot(t){return z(t)&&it(t)}
|
|
|
1020
1041
|
* }
|
|
1021
1042
|
*
|
|
1022
1043
|
*/
|
|
1023
|
-
function
|
|
1044
|
+
function st(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isSocket()}
|
|
1024
1045
|
/**
|
|
1025
1046
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1026
1047
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1038,7 +1059,7 @@ function ut(t){return r.default.statSync(t).isSocket()}
|
|
|
1038
1059
|
* }
|
|
1039
1060
|
*
|
|
1040
1061
|
*/
|
|
1041
|
-
function
|
|
1062
|
+
function ft(t){return H(t)&&st(t)}
|
|
1042
1063
|
/**
|
|
1043
1064
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1044
1065
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1059,7 +1080,7 @@ function st(t){return z(t)&&ut(t)}
|
|
|
1059
1080
|
* }
|
|
1060
1081
|
*
|
|
1061
1082
|
*/
|
|
1062
|
-
function
|
|
1083
|
+
function at(t){if(g(t)&&!(t instanceof Buffer)&&!(t instanceof URL))throw new TypeError("Invalid path type! Expect string, buffer or url.");const n=r.default.statSync(t,{throwIfNoEntry:!1});return c(n)&&n.isSymbolicLink()}
|
|
1063
1084
|
/**
|
|
1064
1085
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1065
1086
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1077,7 +1098,7 @@ function ft(t){return r.default.statSync(t).isSymbolicLink()}
|
|
|
1077
1098
|
* }
|
|
1078
1099
|
*
|
|
1079
1100
|
*/
|
|
1080
|
-
function
|
|
1101
|
+
function ct(t){return H(t)&&at(t)}exports.ABSOLUTE_ZERO_CELSIUS=-273.14999999955,exports.ABSOLUTE_ZERO_FAHRENHEIT=-459.67,exports.ABSOLUTE_ZERO_KELVIN=4.5e-10,exports.isArray=n,exports.isArrayBuffer=U,exports.isArrayOfArray=
|
|
1081
1102
|
/**
|
|
1082
1103
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1083
1104
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1148,7 +1169,7 @@ function(t){return!e(t)&&t.length>1}
|
|
|
1148
1169
|
* }
|
|
1149
1170
|
*
|
|
1150
1171
|
*/
|
|
1151
|
-
function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(h(t[r]))return!1;return!0},exports.isArrayOfObject=function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(
|
|
1172
|
+
function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(h(t[r]))return!1;return!0},exports.isArrayOfObject=function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(E(t[r]))return!1;return!0},exports.isArrayOfSingleElement=
|
|
1152
1173
|
/**
|
|
1153
1174
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1154
1175
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1166,28 +1187,7 @@ function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(
|
|
|
1166
1187
|
* }
|
|
1167
1188
|
*
|
|
1168
1189
|
*/
|
|
1169
|
-
function(t){return!e(t)&&1===t.length},exports.isArrayOfString=function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(g(t[r]))return!1;return!0},exports.isArrayOfUndefined=function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(v(t[r]))return!1;return!0},exports.isBigInt64Array=T,exports.isBigUint64Array=B,exports.isBlankString=F,exports.isBlockDevicePath=q,exports.isBoolean=o,exports.isCelsius
|
|
1170
|
-
/**
|
|
1171
|
-
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1172
|
-
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
1173
|
-
*
|
|
1174
|
-
* @module sources/file-system/files/isEmptyFile
|
|
1175
|
-
* @description Export function to validate if a value is an empty file
|
|
1176
|
-
*
|
|
1177
|
-
* @requires {@link module: [fs]{@link https://nodejs.org/api/fs.html}}
|
|
1178
|
-
*
|
|
1179
|
-
* @example
|
|
1180
|
-
*
|
|
1181
|
-
* import { isEmptyFile } from 'itee-validators'
|
|
1182
|
-
*
|
|
1183
|
-
* if( isEmptyFile( value ) ) {
|
|
1184
|
-
* //...
|
|
1185
|
-
* } else {
|
|
1186
|
-
* //...
|
|
1187
|
-
* }
|
|
1188
|
-
*
|
|
1189
|
-
*/
|
|
1190
|
-
function(t,n=0){return r.default.statSync(t).size<=n},exports.isEmptyObject=E,exports.isEmptyString=S,exports.isFIFOPath=nt,exports.isFahrenheit=G,exports.isFalse=function(t){return o(t)&&!1===t}
|
|
1190
|
+
function(t){return!e(t)&&1===t.length},exports.isArrayOfString=function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(g(t[r]))return!1;return!0},exports.isArrayOfUndefined=function(t){if(e(t))return!1;if(i(t))return!1;for(let r=0,n=t.length;r<n;r++)if(v(t[r]))return!1;return!0},exports.isBigInt64Array=T,exports.isBigUint64Array=B,exports.isBlankString=F,exports.isBlockDevicePath=q,exports.isBoolean=o,exports.isCelsius=$,exports.isCharacterDevicePath=J,exports.isDefined=c,exports.isDirectoryPath=W,exports.isEmpty=O,exports.isEmptyArray=i,exports.isEmptyDirectory=tt,exports.isEmptyFile=ot,exports.isEmptyObject=m,exports.isEmptyString=S,exports.isFIFOPath=nt,exports.isFahrenheit=G,exports.isFalse=function(t){return o(t)&&!1===t}
|
|
1191
1191
|
/**
|
|
1192
1192
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1193
1193
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1221,7 +1221,7 @@ function(t,n=0){return r.default.statSync(t).size<=n},exports.isEmptyObject=E,ex
|
|
|
1221
1221
|
* //...
|
|
1222
1222
|
* }
|
|
1223
1223
|
*
|
|
1224
|
-
*/,exports.isFloat=A,exports.isFloat32Array=
|
|
1224
|
+
*/,exports.isFloat=A,exports.isFloat32Array=V,exports.isFloat64Array=k,exports.isFunction=s,exports.isInfinite=l,exports.isInfiniteNegative=function(t){return t===Number.NEGATIVE_INFINITY},exports.isInfinitePositive=y,exports.isInt16Array=L,exports.isInt32Array=_,exports.isInt8Array=D,exports.isInteger=d,exports.isInvalidBlockDevicePath=function(t){return!z(t)},exports.isInvalidCharacterDevicePath=function(t){return!Q(t)},exports.isInvalidDirectoryPath=function(t){return!rt(t)},exports.isInvalidFIFOPath=function(t){return!et(t)},exports.isInvalidFilePath=function(t){return!ut(t)},exports.isInvalidPath=function(t){return!H(t)},exports.isInvalidSocketPath=function(t){return!ft(t)},exports.isInvalidSymbolicLinkPath=function(t){return!ct(t)},exports.isKelvin=K,exports.isMaxNegative=function(t){return t===-Number.MAX_VALUE}
|
|
1225
1225
|
/**
|
|
1226
1226
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1227
1227
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1256,7 +1256,7 @@ function(t,n=0){return r.default.statSync(t).size<=n},exports.isEmptyObject=E,ex
|
|
|
1256
1256
|
* }
|
|
1257
1257
|
*
|
|
1258
1258
|
*/
|
|
1259
|
-
function(t){return t===Number.MAX_SAFE_INTEGER},exports.isMinNegative=function(t){return t===-Number.MIN_VALUE},exports.isMinPositive=function(t){return t===Number.MIN_VALUE},exports.isMinSafeInteger=function(t){return t===Number.MIN_SAFE_INTEGER},exports.isNaN=function(t){return Number.isNaN(t)},exports.isNotArray=e,exports.isNotArrayBuffer=function(t){return!
|
|
1259
|
+
function(t){return t===Number.MAX_SAFE_INTEGER},exports.isMinNegative=function(t){return t===-Number.MIN_VALUE},exports.isMinPositive=function(t){return t===Number.MIN_VALUE},exports.isMinSafeInteger=function(t){return t===Number.MIN_SAFE_INTEGER},exports.isNaN=function(t){return Number.isNaN(t)},exports.isNotArray=e,exports.isNotArrayBuffer=function(t){return!U(t)},exports.isNotArrayOfArray=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,e=t.length;r<e;r++)if(n(t[r]))return!1;return!0},exports.isNotArrayOfBoolean=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,n=t.length;r<n;r++)if(u(t[r]))return!0;return!1},exports.isNotArrayOfFunction=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,n=t.length;r<n;r++)if(f(t[r]))return!0;return!1},exports.isNotArrayOfNull=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,n=t.length;r<n;r++)if(a(t[r]))return!0;return!1},exports.isNotArrayOfNumber=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,n=t.length;r<n;r++)if(h(t[r]))return!0;return!1},exports.isNotArrayOfObject=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,n=t.length;r<n;r++)if(E(t[r]))return!0;return!1},exports.isNotArrayOfString=function(t){if(e(t))return!0;if(i(t))return!0;for(let r=0,n=t.length;r<n;r++)if(g(t[r]))return!0;return!1}
|
|
1260
1260
|
/**
|
|
1261
1261
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1262
1262
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1290,7 +1290,7 @@ function(t){return t===Number.MAX_SAFE_INTEGER},exports.isMinNegative=function(t
|
|
|
1290
1290
|
* //...
|
|
1291
1291
|
* }
|
|
1292
1292
|
*
|
|
1293
|
-
*/,exports.isNotBigInt64Array=function(t){return!T(t)},exports.isNotBigUint64Array=function(t){return!B(t)},exports.isNotBlankString=function(t){return!F(t)},exports.isNotBlockDevicePath=function(t){return!q(t)},exports.isNotBoolean=u,exports.isNotCelsius=Z,exports.isNotCharacterDevicePath=function(t){return!J(t)},exports.isNotDefined=p,exports.isNotDirectoryPath=function(t){return!W(t)},exports.isNotEmpty=function(t){return!
|
|
1293
|
+
*/,exports.isNotBigInt64Array=function(t){return!T(t)},exports.isNotBigUint64Array=function(t){return!B(t)},exports.isNotBlankString=function(t){return!F(t)},exports.isNotBlockDevicePath=function(t){return!q(t)},exports.isNotBoolean=u,exports.isNotCelsius=Z,exports.isNotCharacterDevicePath=function(t){return!J(t)},exports.isNotDefined=p,exports.isNotDirectoryPath=function(t){return!W(t)},exports.isNotEmpty=function(t){return!O(t)},exports.isNotEmptyArray=function(t){return!!e(t)||t.length>0},exports.isNotEmptyDirectory=function(t){return!tt(t)},exports.isNotEmptyFile=function(t,r=0){return!ot(t,r)},exports.isNotEmptyObject=function(t){return!m(t)},exports.isNotEmptyString=function(t){return!S(t)},exports.isNotFIFOPath=function(t){return!nt(t)},exports.isNotFahrenheit=Y,exports.isNotFilePath=function(t){return!it(t)},exports.isNotFloat32Array=function(t){return!V(t)},exports.isNotFloat64Array=function(t){return!k(t)},exports.isNotFunction=f,exports.isNotInt16Array=function(t){return!L(t)},exports.isNotInt32Array=function(t){return!_(t)},exports.isNotInt8Array=function(t){return!D(t)},exports.isNotKelvin=X,exports.isNotNull=a,exports.isNotNumber=h,exports.isNotObject=E,exports.isNotSocketPath=function(t){return!st(t)},exports.isNotString=g,exports.isNotSymbol=function(t){return"symbol"!=typeof t},exports.isNotSymbolicLinkPath=function(t){return!at(t)},exports.isNotTemperature=function(t){return X(t)&&Z(t)&&Y(t)},exports.isNotUint16Array=function(t){return!M(t)},exports.isNotUint32Array=function(t){return!R(t)},exports.isNotUint8Array=function(t){return!j(t)},exports.isNotUint8ClampedArray=function(t){return!C(t)}
|
|
1294
1294
|
/**
|
|
1295
1295
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
1296
1296
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -1298,4 +1298,4 @@ function(t){return t===Number.MAX_SAFE_INTEGER},exports.isMinNegative=function(t
|
|
|
1298
1298
|
* @module sources/physics/constants
|
|
1299
1299
|
* @desc Export constants about temperatures
|
|
1300
1300
|
*
|
|
1301
|
-
*/,exports.isNotUndefined=v,exports.isNull=function(t){return null===t},exports.isNumber=N,exports.isNumberNegative=function(t){return N(t)&&t<0},exports.isNumberPositive=function(t){return!h(t)&&(t>0||
|
|
1301
|
+
*/,exports.isNotUndefined=v,exports.isNull=function(t){return null===t},exports.isNumber=N,exports.isNumberNegative=function(t){return N(t)&&t<0},exports.isNumberPositive=function(t){return!h(t)&&(t>0||x(t)||y(t))},exports.isObject=I,exports.isSocketPath=st,exports.isString=b,exports.isSymbol=w,exports.isSymbolicLinkPath=at,exports.isTemperature=function(t){return K(t)||$(t)||G(t)},exports.isTrue=function(t){return o(t)&&!0===t},exports.isUint16Array=M,exports.isUint32Array=R,exports.isUint8Array=j,exports.isUint8ClampedArray=C,exports.isUndefined=function(t){return void 0===t},exports.isValidBlockDevicePath=z,exports.isValidCharacterDevicePath=Q,exports.isValidDirectoryPath=rt,exports.isValidFIFOPath=et,exports.isValidFilePath=ut,exports.isValidPath=H,exports.isValidSocketPath=ft,exports.isValidSymbolicLinkPath=ct,exports.isZero=function(t){return 0===t},exports.isZeroNegative=function(t){return 0===t&&1/t===Number.NEGATIVE_INFINITY},exports.isZeroPositive=x;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
console.log('Itee.Validators v5.3.
|
|
1
|
+
console.log('Itee.Validators v5.3.6 - EsModule')
|
|
2
2
|
/**
|
|
3
3
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
4
4
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
@@ -2285,7 +2285,7 @@ const ABSOLUTE_ZERO_FAHRENHEIT = -459.67;
|
|
|
2285
2285
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
2286
2286
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
2287
2287
|
*
|
|
2288
|
-
* @module sources/physics/
|
|
2288
|
+
* @module sources/physics/temperatures
|
|
2289
2289
|
* @desc Export function to validate if a value is a Celsius temperature
|
|
2290
2290
|
* @example
|
|
2291
2291
|
*
|
|
@@ -2301,7 +2301,7 @@ const ABSOLUTE_ZERO_FAHRENHEIT = -459.67;
|
|
|
2301
2301
|
|
|
2302
2302
|
/**
|
|
2303
2303
|
*
|
|
2304
|
-
* @param data
|
|
2304
|
+
* @param data {*}
|
|
2305
2305
|
* @return {boolean}
|
|
2306
2306
|
*/
|
|
2307
2307
|
function isCelsius ( data ) {
|
|
@@ -2310,7 +2310,7 @@ function isCelsius ( data ) {
|
|
|
2310
2310
|
|
|
2311
2311
|
/**
|
|
2312
2312
|
*
|
|
2313
|
-
* @param data
|
|
2313
|
+
* @param data {*}
|
|
2314
2314
|
* @return {boolean}
|
|
2315
2315
|
*/
|
|
2316
2316
|
function isNotCelsius ( data ) {
|
|
@@ -2321,7 +2321,7 @@ function isNotCelsius ( data ) {
|
|
|
2321
2321
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
2322
2322
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
2323
2323
|
*
|
|
2324
|
-
* @module sources/physics/
|
|
2324
|
+
* @module sources/physics/temperatures
|
|
2325
2325
|
* @desc Export function to validate if a value is a Fahrenheit temperature
|
|
2326
2326
|
* @example
|
|
2327
2327
|
*
|
|
@@ -2337,7 +2337,7 @@ function isNotCelsius ( data ) {
|
|
|
2337
2337
|
|
|
2338
2338
|
/**
|
|
2339
2339
|
*
|
|
2340
|
-
* @param data
|
|
2340
|
+
* @param data {*}
|
|
2341
2341
|
* @return {boolean}
|
|
2342
2342
|
*/
|
|
2343
2343
|
function isFahrenheit ( data ) {
|
|
@@ -2346,7 +2346,7 @@ function isFahrenheit ( data ) {
|
|
|
2346
2346
|
|
|
2347
2347
|
/**
|
|
2348
2348
|
*
|
|
2349
|
-
* @param data
|
|
2349
|
+
* @param data {*}
|
|
2350
2350
|
* @return {boolean}
|
|
2351
2351
|
*/
|
|
2352
2352
|
function isNotFahrenheit ( data ) {
|
|
@@ -2357,7 +2357,7 @@ function isNotFahrenheit ( data ) {
|
|
|
2357
2357
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
2358
2358
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
2359
2359
|
*
|
|
2360
|
-
* @module sources/physics/
|
|
2360
|
+
* @module sources/physics/temperatures
|
|
2361
2361
|
* @desc Export function to validate if a value is a kelvin temperature
|
|
2362
2362
|
* @example
|
|
2363
2363
|
*
|
|
@@ -2373,7 +2373,7 @@ function isNotFahrenheit ( data ) {
|
|
|
2373
2373
|
|
|
2374
2374
|
/**
|
|
2375
2375
|
*
|
|
2376
|
-
* @param data
|
|
2376
|
+
* @param data {*}
|
|
2377
2377
|
* @return {boolean}
|
|
2378
2378
|
*/
|
|
2379
2379
|
function isKelvin ( data ) {
|
|
@@ -2382,7 +2382,7 @@ function isKelvin ( data ) {
|
|
|
2382
2382
|
|
|
2383
2383
|
/**
|
|
2384
2384
|
*
|
|
2385
|
-
* @param data
|
|
2385
|
+
* @param data {*}
|
|
2386
2386
|
* @return {boolean}
|
|
2387
2387
|
*/
|
|
2388
2388
|
function isNotKelvin ( data ) {
|
|
@@ -2393,7 +2393,7 @@ function isNotKelvin ( data ) {
|
|
|
2393
2393
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
2394
2394
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
2395
2395
|
*
|
|
2396
|
-
* @module sources/physics/
|
|
2396
|
+
* @module sources/physics/temperatures
|
|
2397
2397
|
* @desc Export function to validate if a value is a temperature
|
|
2398
2398
|
* @example
|
|
2399
2399
|
*
|