itee-validators 5.3.5 → 5.3.7

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 (29) hide show
  1. package/.github/workflows/node.js.yml +1 -1
  2. package/CHANGELOG.md +34 -0
  3. package/builds/itee-validators.cjs.js +87 -48
  4. package/builds/itee-validators.cjs.js.map +1 -1
  5. package/builds/itee-validators.cjs.min.js +64 -64
  6. package/builds/itee-validators.esm.js +11 -11
  7. package/builds/itee-validators.esm.js.map +1 -1
  8. package/builds/itee-validators.esm.min.js +4 -4
  9. package/builds/itee-validators.iife.js +11 -11
  10. package/builds/itee-validators.iife.js.map +1 -1
  11. package/builds/itee-validators.iife.min.js +4 -4
  12. package/package.json +26 -23
  13. package/sources/cores/_cores.js +1 -1
  14. package/sources/cores/numbers/_numbers.js +2 -0
  15. package/sources/cores/tests/isTestUnitGenerator.js +118 -0
  16. package/sources/dom/isEventTarget.js +10 -0
  17. package/sources/file-system/block-devices/isBlockDevicePath.js +9 -2
  18. package/sources/file-system/character-devices/isCharacterDevicePath.js +8 -1
  19. package/sources/file-system/directories/isDirectoryPath.js +8 -1
  20. package/sources/file-system/directories/isEmptyDirectory.js +2 -1
  21. package/sources/file-system/fifo-pipes/isFIFOPath.js +8 -1
  22. package/sources/file-system/files/isEmptyFile.js +9 -3
  23. package/sources/file-system/files/isFilePath.js +8 -1
  24. package/sources/file-system/sockets/isSocketPath.js +8 -1
  25. package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +8 -1
  26. package/sources/physics/temperatures/isCelsius.js +3 -3
  27. package/sources/physics/temperatures/isFahrenheit.js +3 -3
  28. package/sources/physics/temperatures/isKelvin.js +3 -3
  29. package/sources/physics/temperatures/isTemperature.js +1 -1
@@ -16,7 +16,7 @@ jobs:
16
16
  MOZ_HEADLESS: 1
17
17
  strategy:
18
18
  matrix:
19
- node-version: [ 12.x, 14.x, 16.x ]
19
+ node-version: [ 18.x, 20.x, 22.x ]
20
20
  firefox: [ 'latest' ]
21
21
  steps:
22
22
  - name: Use Node.js ${{ matrix.node-version }}
package/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ ## [5.3.7](https://github.com/Itee/itee-validators/compare/v5.3.6...v5.3.7) (2025-09-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **audit:** apply npm audit fix ([51957e0](https://github.com/Itee/itee-validators/commit/51957e0f7cfd0a82beb67bd31e7c08b6e54923f8))
7
+
8
+ ## [5.3.6](https://github.com/Itee/itee-validators/compare/v5.3.5...v5.3.6) (2025-09-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **configs:** add missing rollup tests configs updates ([30aff13](https://github.com/Itee/itee-validators/commit/30aff13c7713a24dc342ac08d2ea8bac25b6b0fb))
14
+ * **file-system:** add parameter check ([54211a7](https://github.com/Itee/itee-validators/commit/54211a7bf3ccfe4ea5a283502d46c69e547049d4))
15
+ * **gulpfile:** fix compute-test-bench task ([bffeaba](https://github.com/Itee/itee-validators/commit/bffeabaa9fbd2322d0df1c8c0be8d319b0697bcf))
16
+ * **gulpfile:** fix compute-test-unit task ([a2f36ae](https://github.com/Itee/itee-validators/commit/a2f36ae73f96e2da056b02fed63eebd5d275dc87))
17
+ * **gulpfile:** fix test building system ([f9aeb4f](https://github.com/Itee/itee-validators/commit/f9aeb4fd667c8058cda1629e5ad1c2a31bd91a95))
18
+ * **gulpfile:** fix wrong rollup call in compute-test-bundle-by-source-file-export task ([27afd98](https://github.com/Itee/itee-validators/commit/27afd98dc244bd1eeb3c3cc565fd2a9d178d4cf6))
19
+ * **gulpfile:** remove help task from release pipeline ([b4bfb71](https://github.com/Itee/itee-validators/commit/b4bfb717d9a42eaed877b733d05c94770b5b24c1))
20
+ * **gulpfile:** remove karma broken tasks due to deprecation ([c2146e9](https://github.com/Itee/itee-validators/commit/c2146e94d03754a2f4394851616c3418cd037fa1))
21
+ * **isblockdevicepath:** avoid throw on stat sync fail ([9d4a94d](https://github.com/Itee/itee-validators/commit/9d4a94d7338fab9620f351d26269a15600fc2aa5))
22
+ * **ischaracterdevicepath:** avoid throw on stat sync fail ([61c831f](https://github.com/Itee/itee-validators/commit/61c831f4b398fca78afaffdb4b35e76fbcc0a175))
23
+ * **isdirectorypath:** avoid throw on stat sync fail ([0d6576c](https://github.com/Itee/itee-validators/commit/0d6576c7e0f22603ceaf227589e5760a3587464b))
24
+ * **isemptydirectory:** avoid throw on stat sync fail ([c32ae20](https://github.com/Itee/itee-validators/commit/c32ae2068861647ab0b6192b817c92449f5477a5))
25
+ * **isemptyfile:** avoid throw null or wrong file path ([abe5b70](https://github.com/Itee/itee-validators/commit/abe5b70269eff627164abe1a6f2d4e548f979f6e))
26
+ * **isfifopath:** avoid throw on stat sync fail ([ddc8d2f](https://github.com/Itee/itee-validators/commit/ddc8d2fe1aca46c6373f2f5c4c3998f8fa25463c))
27
+ * **isfilepath:** avoid throw on stat sync fail ([24d2e4f](https://github.com/Itee/itee-validators/commit/24d2e4f231c2c863976b3961ebc331d4ea951c37))
28
+ * **issocketpath:** avoid throw on stat sync fail ([211aa80](https://github.com/Itee/itee-validators/commit/211aa80afb813d9ab93ab6fdf06271202a2d7ae2))
29
+ * **issymboliclinkpath:** add parameter check ([66c7ec0](https://github.com/Itee/itee-validators/commit/66c7ec0b1dbd443bd29ad54acad9a9bc5e543d0d))
30
+ * **issymboliclinkpath:** avoid throw on stat sync fail ([a0e1e17](https://github.com/Itee/itee-validators/commit/a0e1e17e4384648422c75fd193240665e3fd4df9))
31
+ * **istestunitgenerator:** fix eslint error for test purpose ([0e99747](https://github.com/Itee/itee-validators/commit/0e9974778b071a3b2af2d7e8a97d68a4b16eb094))
32
+ * **npmignore:** fix file name ([86579d1](https://github.com/Itee/itee-validators/commit/86579d183b182d4a840c3a71ddd5b4945058afcc))
33
+ * **units:** fix some source file methode parameters types to fix unit test generation ([0fa0951](https://github.com/Itee/itee-validators/commit/0fa09510c990e266d30af807a2fff5218147ce48))
34
+
1
35
  ## [5.3.5](https://github.com/Itee/itee-validators/compare/v5.3.4...v5.3.5) (2022-02-14)
2
36
 
3
37
 
@@ -1,4 +1,4 @@
1
- console.log('Itee.Validators v5.3.5 - CommonJs')
1
+ console.log('Itee.Validators v5.3.7 - CommonJs')
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2295,7 +2295,7 @@ const ABSOLUTE_ZERO_FAHRENHEIT = -459.67;
2295
2295
  * @author [Tristan Valcke]{@link https://github.com/Itee}
2296
2296
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
2297
2297
  *
2298
- * @module sources/physics/temperatues
2298
+ * @module sources/physics/temperatures
2299
2299
  * @desc Export function to validate if a value is a Celsius temperature
2300
2300
  * @example
2301
2301
  *
@@ -2311,7 +2311,7 @@ const ABSOLUTE_ZERO_FAHRENHEIT = -459.67;
2311
2311
 
2312
2312
  /**
2313
2313
  *
2314
- * @param data
2314
+ * @param data {*}
2315
2315
  * @return {boolean}
2316
2316
  */
2317
2317
  function isCelsius ( data ) {
@@ -2320,7 +2320,7 @@ function isCelsius ( data ) {
2320
2320
 
2321
2321
  /**
2322
2322
  *
2323
- * @param data
2323
+ * @param data {*}
2324
2324
  * @return {boolean}
2325
2325
  */
2326
2326
  function isNotCelsius ( data ) {
@@ -2331,7 +2331,7 @@ function isNotCelsius ( data ) {
2331
2331
  * @author [Tristan Valcke]{@link https://github.com/Itee}
2332
2332
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
2333
2333
  *
2334
- * @module sources/physics/temperatues
2334
+ * @module sources/physics/temperatures
2335
2335
  * @desc Export function to validate if a value is a Fahrenheit temperature
2336
2336
  * @example
2337
2337
  *
@@ -2347,7 +2347,7 @@ function isNotCelsius ( data ) {
2347
2347
 
2348
2348
  /**
2349
2349
  *
2350
- * @param data
2350
+ * @param data {*}
2351
2351
  * @return {boolean}
2352
2352
  */
2353
2353
  function isFahrenheit ( data ) {
@@ -2356,7 +2356,7 @@ function isFahrenheit ( data ) {
2356
2356
 
2357
2357
  /**
2358
2358
  *
2359
- * @param data
2359
+ * @param data {*}
2360
2360
  * @return {boolean}
2361
2361
  */
2362
2362
  function isNotFahrenheit ( data ) {
@@ -2367,7 +2367,7 @@ function isNotFahrenheit ( data ) {
2367
2367
  * @author [Tristan Valcke]{@link https://github.com/Itee}
2368
2368
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
2369
2369
  *
2370
- * @module sources/physics/temperatues
2370
+ * @module sources/physics/temperatures
2371
2371
  * @desc Export function to validate if a value is a kelvin temperature
2372
2372
  * @example
2373
2373
  *
@@ -2383,7 +2383,7 @@ function isNotFahrenheit ( data ) {
2383
2383
 
2384
2384
  /**
2385
2385
  *
2386
- * @param data
2386
+ * @param data {*}
2387
2387
  * @return {boolean}
2388
2388
  */
2389
2389
  function isKelvin ( data ) {
@@ -2392,7 +2392,7 @@ function isKelvin ( data ) {
2392
2392
 
2393
2393
  /**
2394
2394
  *
2395
- * @param data
2395
+ * @param data {*}
2396
2396
  * @return {boolean}
2397
2397
  */
2398
2398
  function isNotKelvin ( data ) {
@@ -2403,7 +2403,7 @@ function isNotKelvin ( data ) {
2403
2403
  * @author [Tristan Valcke]{@link https://github.com/Itee}
2404
2404
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
2405
2405
  *
2406
- * @module sources/physics/temperatues
2406
+ * @module sources/physics/temperatures
2407
2407
  * @desc Export function to validate if a value is a temperature
2408
2408
  * @example
2409
2409
  *
@@ -2463,7 +2463,12 @@ function isNotTemperature ( data ) {
2463
2463
  * @returns {boolean} true if path is a block device path, false otherwise
2464
2464
  */
2465
2465
  function isBlockDevicePath ( path ) {
2466
- return fs__default["default"].statSync( path ).isBlockDevice()
2466
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
2467
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
2468
+ }
2469
+
2470
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
2471
+ return isDefined(stat) && stat.isBlockDevice()
2467
2472
  }
2468
2473
 
2469
2474
  /**
@@ -2583,7 +2588,12 @@ function isInvalidBlockDevicePath ( data ) {
2583
2588
  * @returns {boolean} true if path is a character device path, false otherwise
2584
2589
  */
2585
2590
  function isCharacterDevicePath ( path ) {
2586
- return fs__default["default"].statSync( path ).isCharacterDevice()
2591
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
2592
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
2593
+ }
2594
+
2595
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
2596
+ return isDefined(stat) && stat.isCharacterDevice()
2587
2597
  }
2588
2598
 
2589
2599
  /**
@@ -2662,7 +2672,12 @@ function isInvalidCharacterDevicePath ( data ) {
2662
2672
  * @returns {boolean} true if path is a directory path, false otherwise
2663
2673
  */
2664
2674
  function isDirectoryPath ( path ) {
2665
- return fs__default["default"].statSync( path ).isDirectory()
2675
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
2676
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
2677
+ }
2678
+
2679
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
2680
+ return isDefined(stat) && stat.isDirectory()
2666
2681
  }
2667
2682
 
2668
2683
  /**
@@ -2703,7 +2718,7 @@ function isNotDirectoryPath ( path ) {
2703
2718
  * @returns {boolean} true if directory is empty, false otherwise
2704
2719
  */
2705
2720
  function isEmptyDirectory ( directoryPath ) {
2706
- return ( fs__default["default"].readdirSync( directoryPath ).length === 0 )
2721
+ return isDirectoryPath(directoryPath) && ( fs__default["default"].readdirSync( directoryPath ).length === 0 )
2707
2722
  }
2708
2723
 
2709
2724
  /**
@@ -2782,7 +2797,12 @@ function isInvalidDirectoryPath ( data ) {
2782
2797
  * @returns {boolean} true if path is a fifo path, false otherwise
2783
2798
  */
2784
2799
  function isFIFOPath ( path ) {
2785
- return fs__default["default"].statSync( path ).isFIFO()
2800
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
2801
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
2802
+ }
2803
+
2804
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
2805
+ return isDefined(stat) && stat.isFIFO()
2786
2806
  }
2787
2807
 
2788
2808
  /**
@@ -2840,16 +2860,16 @@ function isInvalidFIFOPath ( data ) {
2840
2860
  * @author [Tristan Valcke]{@link https://github.com/Itee}
2841
2861
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
2842
2862
  *
2843
- * @module sources/file-system/files/isEmptyFile
2844
- * @description Export function to validate if a value is an empty file
2863
+ * @module sources/file-system/files/isFilePath
2864
+ * @description Export function to validate if a value is a file path
2845
2865
  *
2846
2866
  * @requires {@link module: [fs]{@link https://nodejs.org/api/fs.html}}
2847
2867
  *
2848
2868
  * @example
2849
2869
  *
2850
- * import { isEmptyFile } from 'itee-validators'
2870
+ * import { isFilePath } from 'itee-validators'
2851
2871
  *
2852
- * if( isEmptyFile( value ) ) {
2872
+ * if( isFilePath( value ) ) {
2853
2873
  * //...
2854
2874
  * } else {
2855
2875
  * //...
@@ -2858,41 +2878,44 @@ function isInvalidFIFOPath ( data ) {
2858
2878
  */
2859
2879
 
2860
2880
  /**
2861
- * Check if given file path is an empty file more or less a threshold in bytes.
2881
+ * Check if given path is a file path
2862
2882
  *
2863
- * @param filePath {string|Buffer|URL} The directory path to check the emptiness
2864
- * @param threshold {number} An amount of byte below which it consider the file as empty ( 0 as default ).
2865
- * @returns {boolean} true if file is empty, false otherwise
2883
+ * @param path {string|Buffer|URL} The data to check against the file path type
2884
+ * @returns {boolean} true if path is a file path, false otherwise
2866
2885
  */
2867
- function isEmptyFile ( filePath, threshold = 0 ) {
2868
- return ( fs__default["default"].statSync( filePath ).size <= threshold )
2886
+ function isFilePath ( path ) {
2887
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
2888
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
2889
+ }
2890
+
2891
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
2892
+ return isDefined(stat) && stat.isFile()
2869
2893
  }
2870
2894
 
2871
2895
  /**
2872
- * Check if given file path is not an empty file more or less a threshold in bytes.
2896
+ * Check if given path is not a file path
2873
2897
  *
2874
- * @param filePath {string|Buffer|URL} The directory path to check the emptiness
2875
- * @param threshold {number} An amount of byte above which it consider the file as not empty ( 0 as default ).
2876
- * @returns {boolean} true if file is not empty, false otherwise
2898
+ * @param path {string|Buffer|URL} The data to check against the file path type
2899
+ * @returns {boolean} true if path is not a file path, false otherwise
2877
2900
  */
2878
- function isNotEmptyFile ( filePath, threshold = 0 ) {
2879
- return ( fs__default["default"].statSync( filePath ).size > threshold )
2901
+ function isNotFilePath ( path ) {
2902
+ return !isFilePath( path )
2880
2903
  }
2881
2904
 
2882
2905
  /**
2883
2906
  * @author [Tristan Valcke]{@link https://github.com/Itee}
2884
2907
  * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
2885
2908
  *
2886
- * @module sources/file-system/files/isFilePath
2887
- * @description Export function to validate if a value is a file path
2909
+ * @module sources/file-system/files/isEmptyFile
2910
+ * @description Export function to validate if a value is an empty file
2888
2911
  *
2889
2912
  * @requires {@link module: [fs]{@link https://nodejs.org/api/fs.html}}
2890
2913
  *
2891
2914
  * @example
2892
2915
  *
2893
- * import { isFilePath } from 'itee-validators'
2916
+ * import { isEmptyFile } from 'itee-validators'
2894
2917
  *
2895
- * if( isFilePath( value ) ) {
2918
+ * if( isEmptyFile( value ) ) {
2896
2919
  * //...
2897
2920
  * } else {
2898
2921
  * //...
@@ -2901,23 +2924,29 @@ function isNotEmptyFile ( filePath, threshold = 0 ) {
2901
2924
  */
2902
2925
 
2903
2926
  /**
2904
- * Check if given path is a file path
2927
+ * Check if given file path is an empty file more or less a threshold in bytes.
2905
2928
  *
2906
- * @param path {string|Buffer|URL} The data to check against the file path type
2907
- * @returns {boolean} true if path is a file path, false otherwise
2929
+ * @param filePath {string|Buffer|URL} The directory path to check the emptiness
2930
+ * @param threshold {number} An amount of byte below which it consider the file as empty ( 0 as default ).
2931
+ * @returns {boolean} true if file is empty, false otherwise
2908
2932
  */
2909
- function isFilePath ( path ) {
2910
- return fs__default["default"].statSync( path ).isFile()
2933
+ function isEmptyFile ( filePath, threshold = 0 ) {
2934
+ if( isNotString(filePath) && !(filePath instanceof Buffer) && !(filePath instanceof URL) ) {
2935
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
2936
+ }
2937
+
2938
+ return isFilePath(filePath) && ( fs__default["default"].statSync( filePath ).size <= threshold )
2911
2939
  }
2912
2940
 
2913
2941
  /**
2914
- * Check if given path is not a file path
2942
+ * Check if given file path is not an empty file more or less a threshold in bytes.
2915
2943
  *
2916
- * @param path {string|Buffer|URL} The data to check against the file path type
2917
- * @returns {boolean} true if path is not a file path, false otherwise
2944
+ * @param filePath {string|Buffer|URL} The directory path to check the emptiness
2945
+ * @param threshold {number} An amount of byte above which it consider the file as not empty ( 0 as default ).
2946
+ * @returns {boolean} true if file is not empty, false otherwise
2918
2947
  */
2919
- function isNotFilePath ( path ) {
2920
- return !isFilePath( path )
2948
+ function isNotEmptyFile ( filePath, threshold = 0 ) {
2949
+ return !isEmptyFile(filePath, threshold)
2921
2950
  }
2922
2951
 
2923
2952
  /**
@@ -2986,7 +3015,12 @@ function isInvalidFilePath ( data ) {
2986
3015
  * @returns {boolean} true if path is a socket path, false otherwise
2987
3016
  */
2988
3017
  function isSocketPath ( path ) {
2989
- return fs__default["default"].statSync( path ).isSocket()
3018
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
3019
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
3020
+ }
3021
+
3022
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
3023
+ return isDefined(stat) && stat.isSocket()
2990
3024
  }
2991
3025
 
2992
3026
  /**
@@ -3065,7 +3099,12 @@ function isInvalidSocketPath ( data ) {
3065
3099
  * @returns {boolean} true if path is a symbolic link path, false otherwise
3066
3100
  */
3067
3101
  function isSymbolicLinkPath ( path ) {
3068
- return fs__default["default"].statSync( path ).isSymbolicLink()
3102
+ if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
3103
+ throw new TypeError('Invalid path type! Expect string, buffer or url.')
3104
+ }
3105
+
3106
+ const stat = fs__default["default"].statSync( path, { throwIfNoEntry: false } );
3107
+ return isDefined(stat) && stat.isSymbolicLink()
3069
3108
  }
3070
3109
 
3071
3110
  /**