itee-validators 5.5.0 → 5.6.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.
Files changed (36) hide show
  1. package/.github/workflows/node.js.yml +1 -1
  2. package/.tasks/_utils.mjs +66 -0
  3. package/.tasks/builds/build.mjs +65 -0
  4. package/.tasks/cleans/clean.mjs +20 -0
  5. package/.tasks/docs/doc.mjs +37 -0
  6. package/.tasks/helps/help.mjs +195 -0
  7. package/.tasks/lints/lint.mjs +33 -0
  8. package/.tasks/patches/patch.mjs +9 -0
  9. package/.tasks/tests/benchmarks/bundle-benchmarks.mjs +33 -0
  10. package/.tasks/tests/benchmarks/compute-benchmarks.mjs +215 -0
  11. package/.tasks/tests/benchmarks/run-benchmarks-for-backend.mjs +24 -0
  12. package/.tasks/tests/benchmarks/run-benchmarks-for-frontend.mjs +38 -0
  13. package/.tasks/tests/bundling/check-bundling-from-esm-build-import.mjs +167 -0
  14. package/.tasks/tests/bundling/check-bundling-from-esm-files-direct.mjs +129 -0
  15. package/.tasks/tests/bundling/check-bundling-from-esm-files-import.mjs +149 -0
  16. package/.tasks/tests/unit-tests/bundle-unit-tests.mjs +33 -0
  17. package/.tasks/tests/unit-tests/compute-unit-tests.mjs +578 -0
  18. package/.tasks/tests/unit-tests/run-unit-tests-for-backend.mjs +25 -0
  19. package/.tasks/tests/unit-tests/run-unit-tests-for-frontend.mjs +41 -0
  20. package/CHANGELOG.md +10 -0
  21. package/builds/itee-validators.cjs.js +18 -10
  22. package/builds/itee-validators.cjs.js.map +1 -1
  23. package/builds/itee-validators.cjs.min.js +62 -62
  24. package/builds/itee-validators.esm.js +2 -2
  25. package/builds/itee-validators.iife.js +4 -3
  26. package/builds/itee-validators.iife.js.map +1 -1
  27. package/builds/itee-validators.iife.min.js +17 -17
  28. package/package.json +1 -1
  29. package/sources/file-system/block-devices/isBlockDevicePath.js +2 -1
  30. package/sources/file-system/character-devices/isCharacterDevicePath.js +2 -1
  31. package/sources/file-system/directories/isDirectoryPath.js +2 -1
  32. package/sources/file-system/fifo-pipes/isFIFOPath.js +2 -1
  33. package/sources/file-system/files/isEmptyFile.js +2 -1
  34. package/sources/file-system/files/isFilePath.js +2 -1
  35. package/sources/file-system/sockets/isSocketPath.js +2 -1
  36. package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +2 -1
@@ -1,4 +1,4 @@
1
- !function(r){"use strict";
1
+ this.Itee=this.Itee||{},this.Itee.Validators=function(r){"use strict";
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}
@@ -15,7 +15,7 @@
15
15
  * //...
16
16
  * }
17
17
  *
18
- */function n(r){return Array.isArray(r)}function t(r){return!Array.isArray(r)}
18
+ */function t(r){return Array.isArray(r)}function n(r){return!Array.isArray(r)}
19
19
  /**
20
20
  * @author [Tristan Valcke]{@link https://github.com/Itee}
21
21
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -32,7 +32,7 @@
32
32
  * //...
33
33
  * }
34
34
  *
35
- */function i(r){return!t(r)&&0===r.length}
35
+ */function i(r){return!n(r)&&0===r.length}
36
36
  /**
37
37
  * @author [Tristan Valcke]{@link https://github.com/Itee}
38
38
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -171,7 +171,7 @@ function s(r){return null!=r}function c(r){return null==r}
171
171
  * }
172
172
  *
173
173
  */
174
- function g(r){return!c(r)&&r.constructor===Number}function d(r){return!g(r)}function h(r){return Number.isInteger(r)}function p(r){return!d(r)&&(!Number.isNaN(r)&&(!N(r)&&r%1!=0))}
174
+ function g(r){return!c(r)&&r.constructor===Number}function h(r){return!g(r)}function d(r){return Number.isInteger(r)}function I(r){return!h(r)&&(!Number.isNaN(r)&&(!N(r)&&r%1!=0))}
175
175
  /**
176
176
  * @author [Tristan Valcke]{@link https://github.com/Itee}
177
177
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -189,7 +189,7 @@ function g(r){return!c(r)&&r.constructor===Number}function d(r){return!g(r)}func
189
189
  * }
190
190
  *
191
191
  */
192
- function I(r){return!c(r)&&r.constructor===Object}function b(r){return!I(r)}
192
+ function p(r){return!c(r)&&r.constructor===Object}function b(r){return!p(r)}
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 E(r){return"string"==typeof r||r instanceof String}function m(r){return
276
276
  * }
277
277
  *
278
278
  */
279
- function v(r){if(b(r))return!1;if(0===r.length)return!0;for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))return!1;return!0}
279
+ function v(r){if(b(r))return!1;if(0===r.length)return!0;for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t))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}
@@ -474,7 +474,7 @@ function T(r){return!c(r)&&(!!U(r)||(!!i(r)||!!v(r)))}
474
474
  }
475
475
  *
476
476
  */
477
- class V{constructor(){this.validators={Boolean:e,Number:g,Integer:h,Float:p,Array:n,String:E,Object:I,Symbol:F,Function:o},this.errors=[]}add(r,n){if(m(r))throw new TypeError("Validator: Expect type to be a string");if(f(n)&&b(n))throw new TypeError("Validator: Expect validator to be an object or a function");if(s(this.validators[r]))throw new TypeError(`Validator: a validator is already defined for type '${r}'`);this.validators[r]=n}remove(r){delete this.validators[r]}getAvalaibleTypes(){const r=[];for(let n in this.validators)r.push(n);return r}check(r,n,t=!0){const i=this.validators[n];if(c(i))throw new TypeError(`Validator: Unable to find schema validation of type '${n}'`);let e=!0;if(o(i))e=i(r);else{if(!I(i))throw new TypeError(`Validator: Unknown validator of type '${n}'`);{let u=!0;for(let o in i){const a=i[o];if(c(a))throw new TypeError(`Validator: Missing validator for key '${o}' of type '${n}'`);const l=r[o],y=a.required;if(c(l)){if(!y)continue;u=!1}let N=a.fn;if(s(N)){if(f(N))throw new TypeError(`Validator: Invalid validation function for '${o}' with type '${n}'`);u=N(l)}else u=this.check(l,a.type,t);if(!1===u&&(this.errors.push(`Validator: Invalid property '${o}' of type '${a.type}' with value '${l}' in object of type '${n}'`),e=!1,t))break}}}return e}}
477
+ class V{constructor(){this.validators={Boolean:e,Number:g,Integer:d,Float:I,Array:t,String:E,Object:p,Symbol:F,Function:o},this.errors=[]}add(r,t){if(m(r))throw new TypeError("Validator: Expect type to be a string");if(f(t)&&b(t))throw new TypeError("Validator: Expect validator to be an object or a function");if(s(this.validators[r]))throw new TypeError(`Validator: a validator is already defined for type '${r}'`);this.validators[r]=t}remove(r){delete this.validators[r]}getAvalaibleTypes(){const r=[];for(let t in this.validators)r.push(t);return r}check(r,t,n=!0){const i=this.validators[t];if(c(i))throw new TypeError(`Validator: Unable to find schema validation of type '${t}'`);let e=!0;if(o(i))e=i(r);else{if(!p(i))throw new TypeError(`Validator: Unknown validator of type '${t}'`);{let u=!0;for(let o in i){const a=i[o];if(c(a))throw new TypeError(`Validator: Missing validator for key '${o}' of type '${t}'`);const l=r[o],y=a.required;if(c(l)){if(!y)continue;u=!1}let N=a.fn;if(s(N)){if(f(N))throw new TypeError(`Validator: Invalid validation function for '${o}' with type '${t}'`);u=N(l)}else u=this.check(l,a.type,n);if(!1===u&&(this.errors.push(`Validator: Invalid property '${o}' of type '${a.type}' with value '${l}' in object of type '${t}'`),e=!1,n))break}}}return e}}
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}
@@ -768,7 +768,7 @@ function K(r){return g(r)&&r>=G}function X(r){return!K(r)}
768
768
  * //...
769
769
  * }
770
770
  *
771
- */r.ABSOLUTE_ZERO_CELSIUS=G,r.ABSOLUTE_ZERO_FAHRENHEIT=Y,r.ABSOLUTE_ZERO_KELVIN=x,r.isArray=n,r.isArrayBuffer=_,r.isArrayOfArray=
771
+ */return r.ABSOLUTE_ZERO_CELSIUS=G,r.ABSOLUTE_ZERO_FAHRENHEIT=Y,r.ABSOLUTE_ZERO_KELVIN=x,r.isArray=t,r.isArrayBuffer=_,r.isArrayOfArray=
772
772
  /**
773
773
  * @author [Tristan Valcke]{@link https://github.com/Itee}
774
774
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -786,7 +786,7 @@ function K(r){return g(r)&&r>=G}function X(r){return!K(r)}
786
786
  * }
787
787
  *
788
788
  */
789
- function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,i=r.length;n<i;n++)if(t(r[n]))return!1;return!0},r.isArrayOfBoolean=function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(u(r[n]))return!1;return!0},r.isArrayOfFunction=function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(f(r[n]))return!1;return!0},r.isArrayOfMultiElement=
789
+ function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,i=r.length;t<i;t++)if(n(r[t]))return!1;return!0},r.isArrayOfBoolean=function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(u(r[t]))return!1;return!0},r.isArrayOfFunction=function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(f(r[t]))return!1;return!0},r.isArrayOfMultiElement=
790
790
  /**
791
791
  * @author [Tristan Valcke]{@link https://github.com/Itee}
792
792
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -804,7 +804,7 @@ function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,i=r.length;n<i;n++)if(
804
804
  * }
805
805
  *
806
806
  */
807
- function(r){return!t(r)&&r.length>1}
807
+ function(r){return!n(r)&&r.length>1}
808
808
  /**
809
809
  * @author [Tristan Valcke]{@link https://github.com/Itee}
810
810
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -821,7 +821,7 @@ function(r){return!t(r)&&r.length>1}
821
821
  * //...
822
822
  * }
823
823
  *
824
- */,r.isArrayOfNull=function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(a(r[n]))return!1;return!0},r.isArrayOfNumber=
824
+ */,r.isArrayOfNull=function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(a(r[t]))return!1;return!0},r.isArrayOfNumber=
825
825
  /**
826
826
  * @author [Tristan Valcke]{@link https://github.com/Itee}
827
827
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -839,7 +839,7 @@ function(r){return!t(r)&&r.length>1}
839
839
  * }
840
840
  *
841
841
  */
842
- function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(d(r[n]))return!1;return!0},r.isArrayOfObject=function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(b(r[n]))return!1;return!0},r.isArrayOfSingleElement=
842
+ function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(h(r[t]))return!1;return!0},r.isArrayOfObject=function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(b(r[t]))return!1;return!0},r.isArrayOfSingleElement=
843
843
  /**
844
844
  * @author [Tristan Valcke]{@link https://github.com/Itee}
845
845
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -857,7 +857,7 @@ function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(
857
857
  * }
858
858
  *
859
859
  */
860
- function(r){return!t(r)&&1===r.length},r.isArrayOfString=function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(m(r[n]))return!1;return!0},r.isArrayOfUndefined=function(r){if(t(r))return!1;if(i(r))return!1;for(let n=0,t=r.length;n<t;n++)if(O(r[n]))return!1;return!0},r.isBigInt64Array=w,r.isBigUint64Array=B,r.isBlankString=S,r.isBoolean=e,r.isCelsius=K,r.isDefined=s,r.isEmpty=T,r.isEmptyArray=i,r.isEmptyObject=v,r.isEmptyString=U,r.isFahrenheit=D,r.isFalse=function(r){return e(r)&&!1===r}
860
+ function(r){return!n(r)&&1===r.length},r.isArrayOfString=function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(m(r[t]))return!1;return!0},r.isArrayOfUndefined=function(r){if(n(r))return!1;if(i(r))return!1;for(let t=0,n=r.length;t<n;t++)if(O(r[t]))return!1;return!0},r.isBigInt64Array=w,r.isBigUint64Array=B,r.isBlankString=S,r.isBoolean=e,r.isCelsius=K,r.isDefined=s,r.isEmpty=T,r.isEmptyArray=i,r.isEmptyObject=v,r.isEmptyString=U,r.isFahrenheit=D,r.isFalse=function(r){return e(r)&&!1===r}
861
861
  /**
862
862
  * @author [Tristan Valcke]{@link https://github.com/Itee}
863
863
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -891,7 +891,7 @@ function(r){return!t(r)&&1===r.length},r.isArrayOfString=function(r){if(t(r))ret
891
891
  * //...
892
892
  * }
893
893
  *
894
- */,r.isFloat=p,r.isFloat32Array=M,r.isFloat64Array=j,r.isFunction=o,r.isInfinite=N,r.isInfiniteNegative=l,r.isInfinitePositive=y,r.isInt16Array=$,r.isInt32Array=L,r.isInt8Array=P,r.isInteger=h,r.isKelvin=q,r.isMaxNegative=function(r){return r===-Number.MAX_VALUE}
894
+ */,r.isFloat=I,r.isFloat32Array=M,r.isFloat64Array=j,r.isFunction=o,r.isInfinite=N,r.isInfiniteNegative=l,r.isInfinitePositive=y,r.isInt16Array=$,r.isInt32Array=L,r.isInt8Array=P,r.isInteger=d,r.isKelvin=q,r.isMaxNegative=function(r){return r===-Number.MAX_VALUE}
895
895
  /**
896
896
  * @author [Tristan Valcke]{@link https://github.com/Itee}
897
897
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -926,7 +926,7 @@ function(r){return!t(r)&&1===r.length},r.isArrayOfString=function(r){if(t(r))ret
926
926
  * }
927
927
  *
928
928
  */
929
- function(r){return r===Number.MAX_SAFE_INTEGER},r.isMinNegative=function(r){return r===-Number.MIN_VALUE},r.isMinPositive=function(r){return r===Number.MIN_VALUE},r.isMinSafeInteger=function(r){return r===Number.MIN_SAFE_INTEGER},r.isNaN=function(r){return Number.isNaN(r)},r.isNotArray=t,r.isNotArrayBuffer=function(r){return!_(r)},r.isNotArrayOfArray=function(r){if(t(r))return!0;if(i(r))return!0;for(let t=0,i=r.length;t<i;t++)if(n(r[t]))return!1;return!0},r.isNotArrayOfBoolean=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(u(r[n]))return!0;return!1},r.isNotArrayOfFunction=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(f(r[n]))return!0;return!1},r.isNotArrayOfNull=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(a(r[n]))return!0;return!1},r.isNotArrayOfNumber=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(d(r[n]))return!0;return!1},r.isNotArrayOfObject=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(b(r[n]))return!0;return!1},r.isNotArrayOfString=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(m(r[n]))return!0;return!1}
929
+ function(r){return r===Number.MAX_SAFE_INTEGER},r.isMinNegative=function(r){return r===-Number.MIN_VALUE},r.isMinPositive=function(r){return r===Number.MIN_VALUE},r.isMinSafeInteger=function(r){return r===Number.MIN_SAFE_INTEGER},r.isNaN=function(r){return Number.isNaN(r)},r.isNotArray=n,r.isNotArrayBuffer=function(r){return!_(r)},r.isNotArrayOfArray=function(r){if(n(r))return!0;if(i(r))return!0;for(let n=0,i=r.length;n<i;n++)if(t(r[n]))return!1;return!0},r.isNotArrayOfBoolean=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(u(r[t]))return!0;return!1},r.isNotArrayOfFunction=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(f(r[t]))return!0;return!1},r.isNotArrayOfNull=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(a(r[t]))return!0;return!1},r.isNotArrayOfNumber=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(h(r[t]))return!0;return!1},r.isNotArrayOfObject=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(b(r[t]))return!0;return!1},r.isNotArrayOfString=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(m(r[t]))return!0;return!1}
930
930
  /**
931
931
  * @author [Tristan Valcke]{@link https://github.com/Itee}
932
932
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -943,7 +943,7 @@ function(r){return r===Number.MAX_SAFE_INTEGER},r.isMinNegative=function(r){retu
943
943
  * //...
944
944
  * }
945
945
  *
946
- */,r.isNotArrayOfUndefined=function(r){if(t(r))return!0;if(i(r))return!0;for(let n=0,t=r.length;n<t;n++)if(O(r[n]))return!0;return!1}
946
+ */,r.isNotArrayOfUndefined=function(r){if(n(r))return!0;if(i(r))return!0;for(let t=0,n=r.length;t<n;t++)if(O(r[t]))return!0;return!1}
947
947
  /**
948
948
  * @author [Tristan Valcke]{@link https://github.com/Itee}
949
949
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
@@ -960,4 +960,4 @@ function(r){return r===Number.MAX_SAFE_INTEGER},r.isMinNegative=function(r){retu
960
960
  * //...
961
961
  * }
962
962
  *
963
- */,r.isNotBigInt64Array=function(r){return!w(r)},r.isNotBigUint64Array=function(r){return!B(r)},r.isNotBlankString=function(r){return!S(r)},r.isNotBoolean=u,r.isNotCelsius=X,r.isNotDefined=c,r.isNotEmpty=function(r){return!T(r)},r.isNotEmptyArray=function(r){return!!t(r)||r.length>0},r.isNotEmptyObject=function(r){return!v(r)},r.isNotEmptyString=function(r){return!U(r)},r.isNotFahrenheit=H,r.isNotFloat32Array=function(r){return!M(r)},r.isNotFloat64Array=function(r){return!j(r)},r.isNotFunction=f,r.isNotInt16Array=function(r){return!$(r)},r.isNotInt32Array=function(r){return!L(r)},r.isNotInt8Array=function(r){return!P(r)},r.isNotKelvin=z,r.isNotNull=a,r.isNotNumber=d,r.isNotObject=b,r.isNotString=m,r.isNotSymbol=function(r){return"symbol"!=typeof r},r.isNotTemperature=function(r){return z(r)&&X(r)&&H(r)},r.isNotUint16Array=function(r){return!k(r)},r.isNotUint32Array=function(r){return!C(r)},r.isNotUint8Array=function(r){return!R(r)},r.isNotUint8ClampedArray=function(r){return!Z(r)},r.isNotUndefined=O,r.isNull=function(r){return null===r},r.isNumber=g,r.isNumberNegative=function(r){return g(r)&&r<0},r.isNumberPositive=function(r){return!d(r)&&(r>0||A(r)||y(r))},r.isObject=I,r.isString=E,r.isSymbol=F,r.isTemperature=function(r){return q(r)||K(r)||D(r)},r.isTrue=function(r){return e(r)&&!0===r},r.isUint16Array=k,r.isUint32Array=C,r.isUint8Array=R,r.isUint8ClampedArray=Z,r.isUndefined=function(r){return void 0===r},r.isZero=function(r){return 0===r},r.isZeroNegative=function(r){return 0===r&&1/r===Number.NEGATIVE_INFINITY},r.isZeroPositive=A,Object.defineProperty(r,"__esModule",{value:!0})}({});
963
+ */,r.isNotBigInt64Array=function(r){return!w(r)},r.isNotBigUint64Array=function(r){return!B(r)},r.isNotBlankString=function(r){return!S(r)},r.isNotBoolean=u,r.isNotCelsius=X,r.isNotDefined=c,r.isNotEmpty=function(r){return!T(r)},r.isNotEmptyArray=function(r){return!!n(r)||r.length>0},r.isNotEmptyObject=function(r){return!v(r)},r.isNotEmptyString=function(r){return!U(r)},r.isNotFahrenheit=H,r.isNotFloat32Array=function(r){return!M(r)},r.isNotFloat64Array=function(r){return!j(r)},r.isNotFunction=f,r.isNotInt16Array=function(r){return!$(r)},r.isNotInt32Array=function(r){return!L(r)},r.isNotInt8Array=function(r){return!P(r)},r.isNotKelvin=z,r.isNotNull=a,r.isNotNumber=h,r.isNotObject=b,r.isNotString=m,r.isNotSymbol=function(r){return"symbol"!=typeof r},r.isNotTemperature=function(r){return z(r)&&X(r)&&H(r)},r.isNotUint16Array=function(r){return!k(r)},r.isNotUint32Array=function(r){return!C(r)},r.isNotUint8Array=function(r){return!R(r)},r.isNotUint8ClampedArray=function(r){return!Z(r)},r.isNotUndefined=O,r.isNull=function(r){return null===r},r.isNumber=g,r.isNumberNegative=function(r){return g(r)&&r<0},r.isNumberPositive=function(r){return!h(r)&&(r>0||A(r)||y(r))},r.isObject=p,r.isString=E,r.isSymbol=F,r.isTemperature=function(r){return q(r)||K(r)||D(r)},r.isTrue=function(r){return e(r)&&!0===r},r.isUint16Array=k,r.isUint32Array=C,r.isUint8Array=R,r.isUint8ClampedArray=Z,r.isUndefined=function(r){return void 0===r},r.isZero=function(r){return 0===r},r.isZeroNegative=function(r){return 0===r&&1/r===Number.NEGATIVE_INFINITY},r.isZeroPositive=A,Object.defineProperty(r,"__esModule",{value:!0}),r}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itee-validators",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "description": "A library of validation functions use in various Itee projects",
5
5
  "keywords": [
6
6
  "itee",
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isBlockDevicePath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isCharacterDevicePath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isDirectoryPath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isFIFOPath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )
@@ -32,7 +32,8 @@ import { isNotString } from '../../cores/strings/isString'
32
32
  */
33
33
  export function isEmptyFile( filePath, threshold = 0 ) {
34
34
  if ( isNotString( filePath ) && !( filePath instanceof Buffer ) && !( filePath instanceof URL ) ) {
35
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
+ return false
36
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
36
37
  }
37
38
 
38
39
  return isFilePath( filePath ) && ( statSync( filePath ).size <= threshold )
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isFilePath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isSocketPath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )
@@ -31,7 +31,8 @@ import { isNotString } from '../../cores/strings/isString'
31
31
  */
32
32
  export function isSymbolicLinkPath( path ) {
33
33
  if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
34
- throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
34
+ return false
35
+ // throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
35
36
  }
36
37
 
37
38
  const stat = statSync( path, { throwIfNoEntry: false } )