itee-validators 5.6.0 → 6.0.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/.github/workflows/node.js.yml +2 -2
- package/.releaserc.mjs +94 -0
- package/.tasks/.builds/build-benchmarks.task.mjs +16 -0
- package/.tasks/.builds/build-tests.task.mjs +18 -0
- package/.tasks/.builds/build-unit-tests.task.mjs +16 -0
- package/.tasks/.builds/build.task.mjs +46 -0
- package/.tasks/.cleans/clean.task.mjs +23 -0
- package/.tasks/.docs/doc.task.mjs +35 -0
- package/.tasks/.helps/help.task.mjs +151 -0
- package/.tasks/.lints/lint.task.mjs +37 -0
- package/.tasks/.patches/patch.task.mjs +13 -0
- package/.tasks/.releases/release.task.mjs +26 -0
- package/.tasks/.tests/benchmarks/build-benchmarks-backend.task.mjs +42 -0
- package/.tasks/{tests/benchmarks/compute-benchmarks.mjs → .tests/benchmarks/compute-benchmarks.task.mjs} +46 -51
- package/.tasks/.tests/benchmarks/run-benchmarks-for-backend.task.mjs +39 -0
- package/.tasks/.tests/benchmarks/run-benchmarks-for-frontend.task.mjs +41 -0
- package/.tasks/.tests/benchmarks/run-benchmarks.task.mjs +18 -0
- package/.tasks/{tests/bundling/check-bundling-from-esm-build-import.mjs → .tests/bundling/check-bundling-from-esm-build-import.task.mjs} +31 -75
- package/.tasks/.tests/bundling/check-bundling-from-esm-files-direct.task.mjs +77 -0
- package/.tasks/.tests/bundling/check-bundling-from-esm-files-import.task.mjs +95 -0
- package/.tasks/.tests/bundling/check-bundling.task.mjs +20 -0
- package/.tasks/.tests/run-tests.task.mjs +18 -0
- package/.tasks/.tests/unit-tests/build-unit-tests-backend.task.mjs +42 -0
- package/.tasks/{tests/unit-tests/compute-unit-tests.mjs → .tests/unit-tests/compute-unit-tests.task.mjs} +152 -193
- package/.tasks/.tests/unit-tests/run-unit-tests-for-backend.task.mjs +44 -0
- package/.tasks/.tests/unit-tests/run-unit-tests-for-frontend.task.mjs +41 -0
- package/.tasks/.tests/unit-tests/run-unit-tests.task.mjs +18 -0
- package/.tasks/_refresh-gulpfile.task.mjs +65 -0
- package/.tasks/_utils.mjs +159 -33
- package/.tasks/configs/benchmarks.conf.mjs +57 -0
- package/.tasks/configs/build-benchmarks-backend.conf.mjs +51 -0
- package/.tasks/configs/build-unit-tests-backend.conf.mjs +46 -0
- package/.tasks/configs/build.conf.mjs +354 -0
- package/.tasks/configs/check-bundling.conf.mjs +26 -0
- package/.tasks/configs/clean.conf.mjs +9 -0
- package/.tasks/configs/compute-benchmarks.conf.mjs +28 -0
- package/.tasks/configs/compute-unit-tests.conf.mjs +27 -0
- package/.tasks/configs/doc.conf.json +50 -0
- package/.tasks/configs/eslint.conf.mjs +121 -0
- package/.tasks/configs/units.conf.mjs +27 -0
- package/.tasks/itee-benchmarks-framework.js +186 -0
- package/.tasks/itee-reporter.mjs +217 -0
- package/CHANGELOG.md +12 -0
- package/builds/itee-validators.cjs.js +53 -15
- package/builds/itee-validators.cjs.js.map +1 -1
- package/builds/itee-validators.cjs.min.js +36 -35
- package/builds/itee-validators.esm.js +25 -2
- package/builds/itee-validators.esm.js.map +1 -1
- package/builds/itee-validators.esm.min.js +3 -3
- package/builds/itee-validators.iife.js +25 -4
- package/builds/itee-validators.iife.js.map +1 -1
- package/builds/itee-validators.iife.min.js +10 -10
- package/package.json +49 -41
- package/sources/cores/_cores.js +10 -10
- package/sources/cores/arrays/_arrays.js +12 -12
- package/sources/cores/arrays/isArrayOfArray.js +2 -2
- package/sources/cores/arrays/isArrayOfBoolean.js +3 -3
- package/sources/cores/arrays/isArrayOfFunction.js +3 -3
- package/sources/cores/arrays/isArrayOfMultiElement.js +1 -1
- package/sources/cores/arrays/isArrayOfNull.js +3 -3
- package/sources/cores/arrays/isArrayOfNumber.js +3 -3
- package/sources/cores/arrays/isArrayOfObject.js +3 -3
- package/sources/cores/arrays/isArrayOfSingleElement.js +1 -1
- package/sources/cores/arrays/isArrayOfString.js +3 -3
- package/sources/cores/arrays/isArrayOfUndefined.js +3 -3
- package/sources/cores/arrays/isEmptyArray.js +1 -1
- package/sources/cores/booleans/_booleans.js +2 -2
- package/sources/cores/booleans/isTrue.js +1 -1
- package/sources/cores/cores.js +8 -8
- package/sources/cores/functions/_functions.js +1 -1
- package/sources/cores/numbers/_numbers.js +6 -6
- package/sources/cores/numbers/isNumber.js +3 -3
- package/sources/cores/objects/_objects.js +2 -2
- package/sources/cores/objects/isEmptyObject.js +1 -1
- package/sources/cores/objects/isObject.js +1 -1
- package/sources/cores/strings/_strings.js +3 -3
- package/sources/cores/strings/isBlankString.js +2 -2
- package/sources/cores/strings/isEmptyString.js +1 -1
- package/sources/cores/symbols/_symbols.js +1 -1
- package/sources/cores/tests/isTestUnitGenerator.js +5 -6
- package/sources/cores/typed-arrays/_typedArrays.js +12 -12
- package/sources/cores/voids/_voids.js +4 -4
- package/sources/cores/voids/isEmpty.js +4 -4
- package/sources/file-system/_file-system.js +9 -9
- package/sources/file-system/block-devices/_blockDevices.js +3 -3
- package/sources/file-system/block-devices/isBlockDevicePath.js +3 -3
- package/sources/file-system/block-devices/isValidBlockDevicePath.js +2 -2
- package/sources/file-system/character-devices/_characterDevices.js +3 -3
- package/sources/file-system/character-devices/isCharacterDevicePath.js +3 -3
- package/sources/file-system/character-devices/isValidCharacterDevicePath.js +2 -2
- package/sources/file-system/directories/_directories.js +4 -4
- package/sources/file-system/directories/isDirectoryPath.js +3 -3
- package/sources/file-system/directories/isEmptyDirectory.js +2 -2
- package/sources/file-system/directories/isValidDirectoryPath.js +2 -2
- package/sources/file-system/fifo-pipes/_fifoPipes.js +3 -3
- package/sources/file-system/fifo-pipes/isFIFOPath.js +3 -3
- package/sources/file-system/fifo-pipes/isValidFIFOPath.js +2 -2
- package/sources/file-system/files/_files.js +4 -4
- package/sources/file-system/files/isEmptyFile.js +3 -3
- package/sources/file-system/files/isFilePath.js +3 -3
- package/sources/file-system/files/isValidFilePath.js +2 -2
- package/sources/file-system/paths/_paths.js +2 -2
- package/sources/file-system/paths/isValidPath.js +1 -1
- package/sources/file-system/sockets/_sockets.js +3 -3
- package/sources/file-system/sockets/isSocketPath.js +3 -3
- package/sources/file-system/sockets/isValidSocketPath.js +2 -2
- package/sources/file-system/symbolic-links/_symbolicLinks.js +3 -3
- package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +3 -3
- package/sources/file-system/symbolic-links/isValidSymbolicLinkPath.js +2 -2
- package/sources/itee-validators.js +4 -4
- package/sources/maths/_maths.js +1 -1
- package/sources/physics/_physics.js +2 -2
- package/sources/physics/temperatures/_temperatures.js +5 -5
- package/sources/physics/temperatures/isCelsius.js +2 -2
- package/sources/physics/temperatures/isFahrenheit.js +2 -2
- package/sources/physics/temperatures/isKelvin.js +2 -2
- package/sources/physics/temperatures/isTemperature.js +3 -3
- package/.tasks/builds/build.mjs +0 -65
- package/.tasks/cleans/clean.mjs +0 -20
- package/.tasks/docs/doc.mjs +0 -37
- package/.tasks/helps/help.mjs +0 -195
- package/.tasks/lints/lint.mjs +0 -33
- package/.tasks/patches/patch.mjs +0 -9
- package/.tasks/tests/benchmarks/bundle-benchmarks.mjs +0 -33
- package/.tasks/tests/benchmarks/run-benchmarks-for-backend.mjs +0 -24
- package/.tasks/tests/benchmarks/run-benchmarks-for-frontend.mjs +0 -38
- package/.tasks/tests/bundling/check-bundling-from-esm-files-direct.mjs +0 -129
- package/.tasks/tests/bundling/check-bundling-from-esm-files-import.mjs +0 -149
- package/.tasks/tests/unit-tests/bundle-unit-tests.mjs +0 -33
- package/.tasks/tests/unit-tests/run-unit-tests-for-backend.mjs +0 -25
- package/.tasks/tests/unit-tests/run-unit-tests-for-frontend.mjs +0 -41
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ┳ ┓┏ ┓• ┓
|
|
3
|
-
* ┃╋┏┓┏┓ ┃┃┏┓┃┓┏┫┏┓╋┏┓┏┓┏
|
|
2
|
+
* ┳ ┓┏ ┓• ┓ ┏┓ ┏┓ ┏┓ ┏┓ ┏┳
|
|
3
|
+
* ┃╋┏┓┏┓ ┃┃┏┓┃┓┏┫┏┓╋┏┓┏┓┏ ┓┏┣┓ ┃┫ ┃┫ ━━ ┃ ┏┓┏┳┓┏┳┓┏┓┏┓ ┃┏
|
|
4
4
|
* ┻┗┗ ┗ •┗┛┗┻┗┗┗┻┗┻┗┗┛┛ ┛ ┗┛┗┛•┗┛•┗┛ ┗┛┗┛┛┗┗┛┗┗┗┛┛┗┗┛┛
|
|
5
5
|
*
|
|
6
6
|
* @desc A library of validation functions use in various Itee projects
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var fs = require('fs');
|
|
13
|
+
var node_fs = require('node:fs');
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
@@ -70,6 +68,7 @@ function isNotArray( data ) {
|
|
|
70
68
|
*
|
|
71
69
|
*/
|
|
72
70
|
|
|
71
|
+
|
|
73
72
|
/**
|
|
74
73
|
* Check if given data is an empty array
|
|
75
74
|
*
|
|
@@ -116,6 +115,7 @@ function isNotEmptyArray( data ) {
|
|
|
116
115
|
*
|
|
117
116
|
*/
|
|
118
117
|
|
|
118
|
+
|
|
119
119
|
/**
|
|
120
120
|
* Check if given data is an array of array
|
|
121
121
|
*
|
|
@@ -214,6 +214,7 @@ function isNotBoolean( data ) {
|
|
|
214
214
|
*
|
|
215
215
|
*/
|
|
216
216
|
|
|
217
|
+
|
|
217
218
|
/**
|
|
218
219
|
* Check if given data is not an empty array where all values are boolean
|
|
219
220
|
*
|
|
@@ -312,6 +313,7 @@ function isNotFunction( data ) {
|
|
|
312
313
|
*
|
|
313
314
|
*/
|
|
314
315
|
|
|
316
|
+
|
|
315
317
|
/**
|
|
316
318
|
* Check if given data is not an empty array where all values are functions
|
|
317
319
|
*
|
|
@@ -372,6 +374,7 @@ function isNotArrayOfFunction( data ) {
|
|
|
372
374
|
*
|
|
373
375
|
*/
|
|
374
376
|
|
|
377
|
+
|
|
375
378
|
/**
|
|
376
379
|
* Check if given data is an array with multiples values
|
|
377
380
|
*
|
|
@@ -443,6 +446,7 @@ function isNotNull( data ) {
|
|
|
443
446
|
* } *
|
|
444
447
|
*/
|
|
445
448
|
|
|
449
|
+
|
|
446
450
|
/**
|
|
447
451
|
* Check if given data is not an empty array where all values are null
|
|
448
452
|
*
|
|
@@ -651,6 +655,7 @@ function isZeroNegative( data ) {
|
|
|
651
655
|
*
|
|
652
656
|
*/
|
|
653
657
|
|
|
658
|
+
|
|
654
659
|
/**
|
|
655
660
|
* Check if given data is a number
|
|
656
661
|
*
|
|
@@ -754,6 +759,7 @@ function isNaN( data ) {
|
|
|
754
759
|
*
|
|
755
760
|
*/
|
|
756
761
|
|
|
762
|
+
|
|
757
763
|
/**
|
|
758
764
|
* Check if given data is not an empty array where all values are numbers
|
|
759
765
|
*
|
|
@@ -814,6 +820,7 @@ function isNotArrayOfNumber( data ) {
|
|
|
814
820
|
*
|
|
815
821
|
*/
|
|
816
822
|
|
|
823
|
+
|
|
817
824
|
/**
|
|
818
825
|
* Check if given data is an object
|
|
819
826
|
*
|
|
@@ -855,6 +862,7 @@ function isNotObject( data ) {
|
|
|
855
862
|
*
|
|
856
863
|
*/
|
|
857
864
|
|
|
865
|
+
|
|
858
866
|
/**
|
|
859
867
|
* Check if given data is an array where all values are of object type
|
|
860
868
|
*
|
|
@@ -915,6 +923,7 @@ function isNotArrayOfObject( data ) {
|
|
|
915
923
|
*
|
|
916
924
|
*/
|
|
917
925
|
|
|
926
|
+
|
|
918
927
|
/**
|
|
919
928
|
* Check if given data is an array with a single value
|
|
920
929
|
*
|
|
@@ -989,6 +998,7 @@ function isNotString( data ) {
|
|
|
989
998
|
*
|
|
990
999
|
*/
|
|
991
1000
|
|
|
1001
|
+
|
|
992
1002
|
/**
|
|
993
1003
|
* Check if given data is not an empty array where all values are string
|
|
994
1004
|
*
|
|
@@ -1087,6 +1097,7 @@ function isNotUndefined( data ) {
|
|
|
1087
1097
|
*
|
|
1088
1098
|
*/
|
|
1089
1099
|
|
|
1100
|
+
|
|
1090
1101
|
/**
|
|
1091
1102
|
* Check if given data is not an empty array where all values are undefined
|
|
1092
1103
|
*
|
|
@@ -1147,6 +1158,7 @@ function isNotArrayOfUndefined( data ) {
|
|
|
1147
1158
|
*
|
|
1148
1159
|
*/
|
|
1149
1160
|
|
|
1161
|
+
|
|
1150
1162
|
/**
|
|
1151
1163
|
* Check if given data is a boolean with value to true
|
|
1152
1164
|
*
|
|
@@ -1303,6 +1315,7 @@ function isMinSafeInteger( data ) {
|
|
|
1303
1315
|
*
|
|
1304
1316
|
*/
|
|
1305
1317
|
|
|
1318
|
+
|
|
1306
1319
|
/**
|
|
1307
1320
|
* Check if given data is an empty object
|
|
1308
1321
|
*
|
|
@@ -1356,6 +1369,7 @@ function isNotEmptyObject( data ) {
|
|
|
1356
1369
|
*
|
|
1357
1370
|
*/
|
|
1358
1371
|
|
|
1372
|
+
|
|
1359
1373
|
/**
|
|
1360
1374
|
* Check if given data is an empty string
|
|
1361
1375
|
*
|
|
@@ -1402,6 +1416,7 @@ function isNotEmptyString( data ) {
|
|
|
1402
1416
|
*
|
|
1403
1417
|
*/
|
|
1404
1418
|
|
|
1419
|
+
|
|
1405
1420
|
/**
|
|
1406
1421
|
* Check if the given data is a blank string
|
|
1407
1422
|
*
|
|
@@ -1484,6 +1499,7 @@ function isNotSymbol( data ) {
|
|
|
1484
1499
|
*
|
|
1485
1500
|
*/
|
|
1486
1501
|
|
|
1502
|
+
|
|
1487
1503
|
/**
|
|
1488
1504
|
* Check emptiness of given data
|
|
1489
1505
|
*
|
|
@@ -1639,6 +1655,7 @@ function isNotEmpty( data ) {
|
|
|
1639
1655
|
*
|
|
1640
1656
|
*/
|
|
1641
1657
|
|
|
1658
|
+
|
|
1642
1659
|
class Validator {
|
|
1643
1660
|
|
|
1644
1661
|
constructor() {
|
|
@@ -2310,6 +2327,7 @@ const ABSOLUTE_ZERO_FAHRENHEIT = -459.67;
|
|
|
2310
2327
|
*
|
|
2311
2328
|
*/
|
|
2312
2329
|
|
|
2330
|
+
|
|
2313
2331
|
/**
|
|
2314
2332
|
*
|
|
2315
2333
|
* @param data {*}
|
|
@@ -2346,6 +2364,7 @@ function isNotCelsius( data ) {
|
|
|
2346
2364
|
*
|
|
2347
2365
|
*/
|
|
2348
2366
|
|
|
2367
|
+
|
|
2349
2368
|
/**
|
|
2350
2369
|
*
|
|
2351
2370
|
* @param data {*}
|
|
@@ -2382,6 +2401,7 @@ function isNotFahrenheit( data ) {
|
|
|
2382
2401
|
*
|
|
2383
2402
|
*/
|
|
2384
2403
|
|
|
2404
|
+
|
|
2385
2405
|
/**
|
|
2386
2406
|
*
|
|
2387
2407
|
* @param data {*}
|
|
@@ -2418,6 +2438,7 @@ function isNotKelvin( data ) {
|
|
|
2418
2438
|
*
|
|
2419
2439
|
*/
|
|
2420
2440
|
|
|
2441
|
+
|
|
2421
2442
|
/**
|
|
2422
2443
|
*
|
|
2423
2444
|
* @param data {*}
|
|
@@ -2457,6 +2478,7 @@ function isNotTemperature( data ) {
|
|
|
2457
2478
|
*
|
|
2458
2479
|
*/
|
|
2459
2480
|
|
|
2481
|
+
|
|
2460
2482
|
/**
|
|
2461
2483
|
* Check if given path is a block device path
|
|
2462
2484
|
*
|
|
@@ -2469,7 +2491,7 @@ function isBlockDevicePath( path ) {
|
|
|
2469
2491
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
2470
2492
|
}
|
|
2471
2493
|
|
|
2472
|
-
const stat =
|
|
2494
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
2473
2495
|
return isDefined( stat ) && stat.isBlockDevice()
|
|
2474
2496
|
}
|
|
2475
2497
|
|
|
@@ -2504,6 +2526,7 @@ function isNotBlockDevicePath( path ) {
|
|
|
2504
2526
|
*
|
|
2505
2527
|
*/
|
|
2506
2528
|
|
|
2529
|
+
|
|
2507
2530
|
/**
|
|
2508
2531
|
* Check if given data is a valid file path
|
|
2509
2532
|
*
|
|
@@ -2511,7 +2534,7 @@ function isNotBlockDevicePath( path ) {
|
|
|
2511
2534
|
* @returns {boolean} true if data is a valid path, false otherwise
|
|
2512
2535
|
*/
|
|
2513
2536
|
function isValidPath( data ) {
|
|
2514
|
-
return
|
|
2537
|
+
return node_fs.existsSync( data )
|
|
2515
2538
|
}
|
|
2516
2539
|
|
|
2517
2540
|
/**
|
|
@@ -2542,6 +2565,7 @@ function isInvalidPath( data ) {
|
|
|
2542
2565
|
*
|
|
2543
2566
|
*/
|
|
2544
2567
|
|
|
2568
|
+
|
|
2545
2569
|
/**
|
|
2546
2570
|
* Check if given data is a valid block device path
|
|
2547
2571
|
*
|
|
@@ -2583,6 +2607,7 @@ function isInvalidBlockDevicePath( data ) {
|
|
|
2583
2607
|
*
|
|
2584
2608
|
*/
|
|
2585
2609
|
|
|
2610
|
+
|
|
2586
2611
|
/**
|
|
2587
2612
|
* Check if given path is a character device path
|
|
2588
2613
|
*
|
|
@@ -2595,7 +2620,7 @@ function isCharacterDevicePath( path ) {
|
|
|
2595
2620
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
2596
2621
|
}
|
|
2597
2622
|
|
|
2598
|
-
const stat =
|
|
2623
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
2599
2624
|
return isDefined( stat ) && stat.isCharacterDevice()
|
|
2600
2625
|
}
|
|
2601
2626
|
|
|
@@ -2627,6 +2652,7 @@ function isNotCharacterDevicePath( path ) {
|
|
|
2627
2652
|
*
|
|
2628
2653
|
*/
|
|
2629
2654
|
|
|
2655
|
+
|
|
2630
2656
|
/**
|
|
2631
2657
|
* Check if given data is a valid character device path
|
|
2632
2658
|
*
|
|
@@ -2668,6 +2694,7 @@ function isInvalidCharacterDevicePath( data ) {
|
|
|
2668
2694
|
*
|
|
2669
2695
|
*/
|
|
2670
2696
|
|
|
2697
|
+
|
|
2671
2698
|
/**
|
|
2672
2699
|
* Check if given path is a directory path
|
|
2673
2700
|
*
|
|
@@ -2680,7 +2707,7 @@ function isDirectoryPath( path ) {
|
|
|
2680
2707
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
2681
2708
|
}
|
|
2682
2709
|
|
|
2683
|
-
const stat =
|
|
2710
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
2684
2711
|
return isDefined( stat ) && stat.isDirectory()
|
|
2685
2712
|
}
|
|
2686
2713
|
|
|
@@ -2715,6 +2742,7 @@ function isNotDirectoryPath( path ) {
|
|
|
2715
2742
|
*
|
|
2716
2743
|
*/
|
|
2717
2744
|
|
|
2745
|
+
|
|
2718
2746
|
/**
|
|
2719
2747
|
* Check if given directory path is an empty directory
|
|
2720
2748
|
*
|
|
@@ -2722,7 +2750,7 @@ function isNotDirectoryPath( path ) {
|
|
|
2722
2750
|
* @returns {boolean} true if directory is empty, false otherwise
|
|
2723
2751
|
*/
|
|
2724
2752
|
function isEmptyDirectory( directoryPath ) {
|
|
2725
|
-
return isDirectoryPath( directoryPath ) && (
|
|
2753
|
+
return isDirectoryPath( directoryPath ) && ( node_fs.readdirSync( directoryPath ).length === 0 )
|
|
2726
2754
|
}
|
|
2727
2755
|
|
|
2728
2756
|
/**
|
|
@@ -2753,6 +2781,7 @@ function isNotEmptyDirectory( directoryPath ) {
|
|
|
2753
2781
|
*
|
|
2754
2782
|
*/
|
|
2755
2783
|
|
|
2784
|
+
|
|
2756
2785
|
/**
|
|
2757
2786
|
* Check if given data is a valid directory path
|
|
2758
2787
|
*
|
|
@@ -2794,6 +2823,7 @@ function isInvalidDirectoryPath( data ) {
|
|
|
2794
2823
|
*
|
|
2795
2824
|
*/
|
|
2796
2825
|
|
|
2826
|
+
|
|
2797
2827
|
/**
|
|
2798
2828
|
* Check if given path is a fifo path
|
|
2799
2829
|
*
|
|
@@ -2806,7 +2836,7 @@ function isFIFOPath( path ) {
|
|
|
2806
2836
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
2807
2837
|
}
|
|
2808
2838
|
|
|
2809
|
-
const stat =
|
|
2839
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
2810
2840
|
return isDefined( stat ) && stat.isFIFO()
|
|
2811
2841
|
}
|
|
2812
2842
|
|
|
@@ -2841,6 +2871,7 @@ function isNotFIFOPath( path ) {
|
|
|
2841
2871
|
*
|
|
2842
2872
|
*/
|
|
2843
2873
|
|
|
2874
|
+
|
|
2844
2875
|
/**
|
|
2845
2876
|
* Check if given data is a valid fifo path
|
|
2846
2877
|
*
|
|
@@ -2882,6 +2913,7 @@ function isInvalidFIFOPath( data ) {
|
|
|
2882
2913
|
*
|
|
2883
2914
|
*/
|
|
2884
2915
|
|
|
2916
|
+
|
|
2885
2917
|
/**
|
|
2886
2918
|
* Check if given path is a file path
|
|
2887
2919
|
*
|
|
@@ -2894,7 +2926,7 @@ function isFilePath( path ) {
|
|
|
2894
2926
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
2895
2927
|
}
|
|
2896
2928
|
|
|
2897
|
-
const stat =
|
|
2929
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
2898
2930
|
return isDefined( stat ) && stat.isFile()
|
|
2899
2931
|
}
|
|
2900
2932
|
|
|
@@ -2929,6 +2961,7 @@ function isNotFilePath( path ) {
|
|
|
2929
2961
|
*
|
|
2930
2962
|
*/
|
|
2931
2963
|
|
|
2964
|
+
|
|
2932
2965
|
/**
|
|
2933
2966
|
* Check if given file path is an empty file more or less a threshold in bytes.
|
|
2934
2967
|
*
|
|
@@ -2942,7 +2975,7 @@ function isEmptyFile( filePath, threshold = 0 ) {
|
|
|
2942
2975
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
2943
2976
|
}
|
|
2944
2977
|
|
|
2945
|
-
return isFilePath( filePath ) && (
|
|
2978
|
+
return isFilePath( filePath ) && ( node_fs.statSync( filePath ).size <= threshold )
|
|
2946
2979
|
}
|
|
2947
2980
|
|
|
2948
2981
|
/**
|
|
@@ -2974,6 +3007,7 @@ function isNotEmptyFile( filePath, threshold = 0 ) {
|
|
|
2974
3007
|
*
|
|
2975
3008
|
*/
|
|
2976
3009
|
|
|
3010
|
+
|
|
2977
3011
|
/**
|
|
2978
3012
|
* Check if given data is a valid file path
|
|
2979
3013
|
*
|
|
@@ -3015,6 +3049,7 @@ function isInvalidFilePath( data ) {
|
|
|
3015
3049
|
*
|
|
3016
3050
|
*/
|
|
3017
3051
|
|
|
3052
|
+
|
|
3018
3053
|
/**
|
|
3019
3054
|
* Check if given path is a socket path
|
|
3020
3055
|
*
|
|
@@ -3027,7 +3062,7 @@ function isSocketPath( path ) {
|
|
|
3027
3062
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
3028
3063
|
}
|
|
3029
3064
|
|
|
3030
|
-
const stat =
|
|
3065
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
3031
3066
|
return isDefined( stat ) && stat.isSocket()
|
|
3032
3067
|
}
|
|
3033
3068
|
|
|
@@ -3059,6 +3094,7 @@ function isNotSocketPath( path ) {
|
|
|
3059
3094
|
*
|
|
3060
3095
|
*/
|
|
3061
3096
|
|
|
3097
|
+
|
|
3062
3098
|
/**
|
|
3063
3099
|
* Check if given data is a valid socket path
|
|
3064
3100
|
*
|
|
@@ -3100,6 +3136,7 @@ function isInvalidSocketPath( data ) {
|
|
|
3100
3136
|
*
|
|
3101
3137
|
*/
|
|
3102
3138
|
|
|
3139
|
+
|
|
3103
3140
|
/**
|
|
3104
3141
|
* Check if given path is a symbolic link path
|
|
3105
3142
|
*
|
|
@@ -3112,7 +3149,7 @@ function isSymbolicLinkPath( path ) {
|
|
|
3112
3149
|
// throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
3113
3150
|
}
|
|
3114
3151
|
|
|
3115
|
-
const stat =
|
|
3152
|
+
const stat = node_fs.statSync( path, { throwIfNoEntry: false } );
|
|
3116
3153
|
return isDefined( stat ) && stat.isSymbolicLink()
|
|
3117
3154
|
}
|
|
3118
3155
|
|
|
@@ -3144,6 +3181,7 @@ function isNotSymbolicLinkPath( path ) {
|
|
|
3144
3181
|
*
|
|
3145
3182
|
*/
|
|
3146
3183
|
|
|
3184
|
+
|
|
3147
3185
|
/**
|
|
3148
3186
|
* Check if given data is a valid symbolic link path
|
|
3149
3187
|
*
|