itee-validators 5.3.9 → 5.4.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/CHANGELOG.md +15 -0
- package/builds/itee-validators.cjs.js +278 -277
- package/builds/itee-validators.cjs.js.map +1 -1
- package/builds/itee-validators.cjs.min.js +144 -144
- package/builds/itee-validators.esm.js +210 -205
- package/builds/itee-validators.esm.js.map +1 -1
- package/builds/itee-validators.esm.min.js +97 -97
- package/builds/itee-validators.iife.js +210 -205
- package/builds/itee-validators.iife.js.map +1 -1
- package/builds/itee-validators.iife.min.js +115 -115
- package/package.json +3 -1
- package/sources/cores/arrays/isArray.js +4 -4
- package/sources/cores/arrays/isArrayOfArray.js +2 -2
- package/sources/cores/arrays/isArrayOfBoolean.js +2 -2
- package/sources/cores/arrays/isArrayOfFunction.js +2 -2
- package/sources/cores/arrays/isArrayOfMultiElement.js +1 -1
- package/sources/cores/arrays/isArrayOfNull.js +2 -2
- package/sources/cores/arrays/isArrayOfNumber.js +2 -2
- package/sources/cores/arrays/isArrayOfObject.js +2 -2
- package/sources/cores/arrays/isArrayOfSingleElement.js +1 -1
- package/sources/cores/arrays/isArrayOfString.js +3 -3
- package/sources/cores/arrays/isArrayOfUndefined.js +2 -2
- package/sources/cores/arrays/isEmptyArray.js +2 -2
- package/sources/cores/booleans/isBoolean.js +4 -4
- package/sources/cores/booleans/isTrue.js +2 -2
- package/sources/cores/cores.js +91 -91
- package/sources/cores/functions/isFunction.js +2 -2
- package/sources/cores/numbers/isInfinite.js +13 -19
- package/sources/cores/numbers/isMax.js +2 -2
- package/sources/cores/numbers/isMin.js +2 -2
- package/sources/cores/numbers/isNumber.js +15 -15
- package/sources/cores/numbers/isSafeInteger.js +2 -2
- package/sources/cores/numbers/isZero.js +3 -3
- package/sources/cores/objects/isEmptyObject.js +2 -2
- package/sources/cores/objects/isObject.js +2 -2
- package/sources/cores/strings/isBlankString.js +2 -2
- package/sources/cores/strings/isEmptyString.js +2 -2
- package/sources/cores/strings/isString.js +7 -7
- package/sources/cores/symbols/isSymbol.js +2 -2
- package/sources/cores/tests/isTestUnitGenerator.js +10 -10
- package/sources/cores/typed-arrays/isArrayBuffer.js +2 -2
- package/sources/cores/typed-arrays/isBigInt64Array.js +2 -2
- package/sources/cores/typed-arrays/isBigUint64Array.js +2 -2
- package/sources/cores/typed-arrays/isFloat32Array.js +2 -2
- package/sources/cores/typed-arrays/isFloat64Array.js +2 -2
- package/sources/cores/typed-arrays/isInt16Array.js +2 -2
- package/sources/cores/typed-arrays/isInt32Array.js +2 -2
- package/sources/cores/typed-arrays/isInt8Array.js +2 -2
- package/sources/cores/typed-arrays/isUint16Array.js +2 -2
- package/sources/cores/typed-arrays/isUint32Array.js +2 -2
- package/sources/cores/typed-arrays/isUint8Array.js +2 -2
- package/sources/cores/typed-arrays/isUint8ClampedArray.js +2 -2
- package/sources/cores/voids/isDefined.js +2 -2
- package/sources/cores/voids/isEmpty.js +2 -2
- package/sources/cores/voids/isNull.js +3 -3
- package/sources/cores/voids/isUndefined.js +2 -2
- package/sources/dom/isEventTarget.js +2 -2
- package/sources/file-system/block-devices/isBlockDevicePath.js +9 -9
- package/sources/file-system/block-devices/isValidBlockDevicePath.js +2 -2
- package/sources/file-system/character-devices/isCharacterDevicePath.js +9 -9
- package/sources/file-system/character-devices/isValidCharacterDevicePath.js +2 -2
- package/sources/file-system/directories/isDirectoryPath.js +9 -9
- package/sources/file-system/directories/isEmptyDirectory.js +4 -4
- package/sources/file-system/directories/isValidDirectoryPath.js +2 -2
- package/sources/file-system/fifo-pipes/isFIFOPath.js +9 -9
- package/sources/file-system/fifo-pipes/isValidFIFOPath.js +2 -2
- package/sources/file-system/files/isEmptyFile.js +9 -9
- package/sources/file-system/files/isFilePath.js +9 -9
- package/sources/file-system/files/isValidFilePath.js +2 -2
- package/sources/file-system/paths/isValidPath.js +4 -4
- package/sources/file-system/sockets/isSocketPath.js +9 -9
- package/sources/file-system/sockets/isValidSocketPath.js +2 -2
- package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +9 -9
- package/sources/file-system/symbolic-links/isValidSymbolicLinkPath.js +2 -2
- package/sources/itee-validators.js +1 -14
- 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 +2 -2
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import { isDefined }
|
|
24
|
-
import {isNotString} from '../../cores/strings/isString'
|
|
22
|
+
import { statSync } from 'fs'
|
|
23
|
+
import { isDefined } from '../../cores/voids/isDefined'
|
|
24
|
+
import { isNotString } from '../../cores/strings/isString'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Check if given path is a directory path
|
|
@@ -29,13 +29,13 @@ import {isNotString} from '../../cores/strings/isString';
|
|
|
29
29
|
* @param path {string|Buffer|URL} The data to check against the directory path type
|
|
30
30
|
* @returns {boolean} true if path is a directory path, false otherwise
|
|
31
31
|
*/
|
|
32
|
-
export function isDirectoryPath
|
|
33
|
-
if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
|
|
34
|
-
throw new TypeError('Invalid path type! Expect string, buffer or url.')
|
|
32
|
+
export function isDirectoryPath( path ) {
|
|
33
|
+
if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
|
|
34
|
+
throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const stat =
|
|
38
|
-
return isDefined(stat) && stat.isDirectory()
|
|
37
|
+
const stat = statSync( path, { throwIfNoEntry: false } )
|
|
38
|
+
return isDefined( stat ) && stat.isDirectory()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -44,6 +44,6 @@ export function isDirectoryPath ( path ) {
|
|
|
44
44
|
* @param path {string|Buffer|URL} The data to check against the directory path type
|
|
45
45
|
* @returns {boolean} true if path is a not directory path, false otherwise
|
|
46
46
|
*/
|
|
47
|
-
export function isNotDirectoryPath
|
|
47
|
+
export function isNotDirectoryPath( path ) {
|
|
48
48
|
return !isDirectoryPath( path )
|
|
49
49
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
22
|
+
import { readdirSync } from 'fs'
|
|
23
23
|
import { isDirectoryPath } from './isDirectoryPath'
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -28,8 +28,8 @@ import { isDirectoryPath } from './isDirectoryPath'
|
|
|
28
28
|
* @param directoryPath {string|Buffer|URL} The directory path to check the emptiness
|
|
29
29
|
* @returns {boolean} true if directory is empty, false otherwise
|
|
30
30
|
*/
|
|
31
|
-
export function isEmptyDirectory
|
|
32
|
-
return isDirectoryPath(directoryPath) && (
|
|
31
|
+
export function isEmptyDirectory( directoryPath ) {
|
|
32
|
+
return isDirectoryPath( directoryPath ) && ( readdirSync( directoryPath ).length === 0 )
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -38,6 +38,6 @@ export function isEmptyDirectory ( directoryPath ) {
|
|
|
38
38
|
* @param directoryPath {string|Buffer|URL} The directory path to check the emptiness
|
|
39
39
|
* @returns {boolean} true if directory is not empty, false otherwise
|
|
40
40
|
*/
|
|
41
|
-
export function isNotEmptyDirectory
|
|
41
|
+
export function isNotEmptyDirectory( directoryPath ) {
|
|
42
42
|
return !isEmptyDirectory( directoryPath )
|
|
43
43
|
}
|
|
@@ -25,7 +25,7 @@ import { isDirectoryPath } from './isDirectoryPath'
|
|
|
25
25
|
* @param data {*} The data to check against the directory path type
|
|
26
26
|
* @returns {boolean} true if data is a valid directory path, false otherwise
|
|
27
27
|
*/
|
|
28
|
-
export function isValidDirectoryPath
|
|
28
|
+
export function isValidDirectoryPath( data ) {
|
|
29
29
|
return ( isValidPath( data ) && isDirectoryPath( data ) )
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,6 +35,6 @@ export function isValidDirectoryPath ( data ) {
|
|
|
35
35
|
* @param data {*} The data to check against the directory path type
|
|
36
36
|
* @returns {boolean} true if data is an invalid directory path, false otherwise
|
|
37
37
|
*/
|
|
38
|
-
export function isInvalidDirectoryPath
|
|
38
|
+
export function isInvalidDirectoryPath( data ) {
|
|
39
39
|
return !isValidDirectoryPath( data )
|
|
40
40
|
}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import { isDefined }
|
|
24
|
-
import {isNotString} from '../../cores/strings/isString'
|
|
22
|
+
import { statSync } from 'fs'
|
|
23
|
+
import { isDefined } from '../../cores/voids/isDefined'
|
|
24
|
+
import { isNotString } from '../../cores/strings/isString'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Check if given path is a fifo path
|
|
@@ -29,13 +29,13 @@ import {isNotString} from '../../cores/strings/isString';
|
|
|
29
29
|
* @param path {string|Buffer|URL} The data to check against the fifo path type
|
|
30
30
|
* @returns {boolean} true if path is a fifo path, false otherwise
|
|
31
31
|
*/
|
|
32
|
-
export function isFIFOPath
|
|
33
|
-
if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
|
|
34
|
-
throw new TypeError('Invalid path type! Expect string, buffer or url.')
|
|
32
|
+
export function isFIFOPath( path ) {
|
|
33
|
+
if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
|
|
34
|
+
throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const stat =
|
|
38
|
-
return isDefined(stat) && stat.isFIFO()
|
|
37
|
+
const stat = statSync( path, { throwIfNoEntry: false } )
|
|
38
|
+
return isDefined( stat ) && stat.isFIFO()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -44,6 +44,6 @@ export function isFIFOPath ( path ) {
|
|
|
44
44
|
* @param path {string|Buffer|URL} The data to check against the fifo path type
|
|
45
45
|
* @returns {boolean} true if path is not a fifo path, false otherwise
|
|
46
46
|
*/
|
|
47
|
-
export function isNotFIFOPath
|
|
47
|
+
export function isNotFIFOPath( path ) {
|
|
48
48
|
return !isFIFOPath( path )
|
|
49
49
|
}
|
|
@@ -28,7 +28,7 @@ import { isFIFOPath } from './isFIFOPath'
|
|
|
28
28
|
* @param data {*} The data to check against the fifo path type
|
|
29
29
|
* @returns {boolean} true if data is a valid fifo path, false otherwise
|
|
30
30
|
*/
|
|
31
|
-
export function isValidFIFOPath
|
|
31
|
+
export function isValidFIFOPath( data ) {
|
|
32
32
|
return ( isValidPath( data ) && isFIFOPath( data ) )
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -38,6 +38,6 @@ export function isValidFIFOPath ( data ) {
|
|
|
38
38
|
* @param data {*} The data to check against the fifo path type
|
|
39
39
|
* @returns {boolean} true if data is an invalid fifo path, false otherwise
|
|
40
40
|
*/
|
|
41
|
-
export function isInvalidFIFOPath
|
|
41
|
+
export function isInvalidFIFOPath( data ) {
|
|
42
42
|
return !isValidFIFOPath( data )
|
|
43
43
|
}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import { isFilePath }
|
|
24
|
-
import {isNotString} from '../../cores/strings/isString'
|
|
22
|
+
import { statSync } from 'fs'
|
|
23
|
+
import { isFilePath } from './isFilePath'
|
|
24
|
+
import { isNotString } from '../../cores/strings/isString'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Check if given file path is an empty file more or less a threshold in bytes.
|
|
@@ -30,12 +30,12 @@ import {isNotString} from '../../cores/strings/isString';
|
|
|
30
30
|
* @param threshold {number} An amount of byte below which it consider the file as empty ( 0 as default ).
|
|
31
31
|
* @returns {boolean} true if file is empty, false otherwise
|
|
32
32
|
*/
|
|
33
|
-
export function isEmptyFile
|
|
34
|
-
if( isNotString(filePath) && !(filePath instanceof Buffer) && !(filePath instanceof URL) ) {
|
|
35
|
-
throw new TypeError('Invalid path type! Expect string, buffer or url.')
|
|
33
|
+
export function isEmptyFile( filePath, threshold = 0 ) {
|
|
34
|
+
if ( isNotString( filePath ) && !( filePath instanceof Buffer ) && !( filePath instanceof URL ) ) {
|
|
35
|
+
throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return isFilePath(filePath) && (
|
|
38
|
+
return isFilePath( filePath ) && ( statSync( filePath ).size <= threshold )
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -45,6 +45,6 @@ export function isEmptyFile ( filePath, threshold = 0 ) {
|
|
|
45
45
|
* @param threshold {number} An amount of byte above which it consider the file as not empty ( 0 as default ).
|
|
46
46
|
* @returns {boolean} true if file is not empty, false otherwise
|
|
47
47
|
*/
|
|
48
|
-
export function isNotEmptyFile
|
|
49
|
-
return !isEmptyFile(filePath, threshold)
|
|
48
|
+
export function isNotEmptyFile( filePath, threshold = 0 ) {
|
|
49
|
+
return !isEmptyFile( filePath, threshold )
|
|
50
50
|
}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import { isDefined }
|
|
24
|
-
import {isNotString} from '../../cores/strings/isString'
|
|
22
|
+
import { statSync } from 'fs'
|
|
23
|
+
import { isDefined } from '../../cores/voids/isDefined'
|
|
24
|
+
import { isNotString } from '../../cores/strings/isString'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Check if given path is a file path
|
|
@@ -29,13 +29,13 @@ import {isNotString} from '../../cores/strings/isString';
|
|
|
29
29
|
* @param path {string|Buffer|URL} The data to check against the file path type
|
|
30
30
|
* @returns {boolean} true if path is a file path, false otherwise
|
|
31
31
|
*/
|
|
32
|
-
export function isFilePath
|
|
33
|
-
if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
|
|
34
|
-
throw new TypeError('Invalid path type! Expect string, buffer or url.')
|
|
32
|
+
export function isFilePath( path ) {
|
|
33
|
+
if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
|
|
34
|
+
throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const stat =
|
|
38
|
-
return isDefined(stat) && stat.isFile()
|
|
37
|
+
const stat = statSync( path, { throwIfNoEntry: false } )
|
|
38
|
+
return isDefined( stat ) && stat.isFile()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -44,6 +44,6 @@ export function isFilePath ( path ) {
|
|
|
44
44
|
* @param path {string|Buffer|URL} The data to check against the file path type
|
|
45
45
|
* @returns {boolean} true if path is not a file path, false otherwise
|
|
46
46
|
*/
|
|
47
|
-
export function isNotFilePath
|
|
47
|
+
export function isNotFilePath( path ) {
|
|
48
48
|
return !isFilePath( path )
|
|
49
49
|
}
|
|
@@ -25,7 +25,7 @@ import { isFilePath } from './isFilePath'
|
|
|
25
25
|
* @param data {*} The data to check against the file path type
|
|
26
26
|
* @returns {boolean} true if data is a valid file path, false otherwise
|
|
27
27
|
*/
|
|
28
|
-
export function isValidFilePath
|
|
28
|
+
export function isValidFilePath( data ) {
|
|
29
29
|
return ( isValidPath( data ) && isFilePath( data ) )
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,6 +35,6 @@ export function isValidFilePath ( data ) {
|
|
|
35
35
|
* @param data {*} The data to check against the file path type
|
|
36
36
|
* @returns {boolean} true if data is an invalid file path, false otherwise
|
|
37
37
|
*/
|
|
38
|
-
export function isInvalidFilePath
|
|
38
|
+
export function isInvalidFilePath( data ) {
|
|
39
39
|
return !isValidFilePath( data )
|
|
40
40
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
22
|
+
import { existsSync } from 'fs'
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Check if given data is a valid file path
|
|
@@ -27,8 +27,8 @@ import fs from 'fs'
|
|
|
27
27
|
* @param data {*} The data to check against the path type
|
|
28
28
|
* @returns {boolean} true if data is a valid path, false otherwise
|
|
29
29
|
*/
|
|
30
|
-
export function isValidPath
|
|
31
|
-
return
|
|
30
|
+
export function isValidPath( data ) {
|
|
31
|
+
return existsSync( data )
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -37,6 +37,6 @@ export function isValidPath ( data ) {
|
|
|
37
37
|
* @param data {*} The data to check against the path type
|
|
38
38
|
* @returns {boolean} true if data is a valid path, false otherwise
|
|
39
39
|
*/
|
|
40
|
-
export function isInvalidPath
|
|
40
|
+
export function isInvalidPath( data ) {
|
|
41
41
|
return !isValidPath( data )
|
|
42
42
|
}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import { isDefined }
|
|
24
|
-
import {isNotString} from '../../cores/strings/isString'
|
|
22
|
+
import { statSync } from 'fs'
|
|
23
|
+
import { isDefined } from '../../cores/voids/isDefined'
|
|
24
|
+
import { isNotString } from '../../cores/strings/isString'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Check if given path is a socket path
|
|
@@ -29,13 +29,13 @@ import {isNotString} from '../../cores/strings/isString';
|
|
|
29
29
|
* @param path {string|Buffer|URL} The data to check against the socket path type
|
|
30
30
|
* @returns {boolean} true if path is a socket path, false otherwise
|
|
31
31
|
*/
|
|
32
|
-
export function isSocketPath
|
|
33
|
-
if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
|
|
34
|
-
throw new TypeError('Invalid path type! Expect string, buffer or url.')
|
|
32
|
+
export function isSocketPath( path ) {
|
|
33
|
+
if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
|
|
34
|
+
throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const stat =
|
|
38
|
-
return isDefined(stat) && stat.isSocket()
|
|
37
|
+
const stat = statSync( path, { throwIfNoEntry: false } )
|
|
38
|
+
return isDefined( stat ) && stat.isSocket()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -44,6 +44,6 @@ export function isSocketPath ( path ) {
|
|
|
44
44
|
* @param path {string|Buffer|URL} The data to check against the socket path type
|
|
45
45
|
* @returns {boolean} true if path is not a socket path, false otherwise
|
|
46
46
|
*/
|
|
47
|
-
export function isNotSocketPath
|
|
47
|
+
export function isNotSocketPath( path ) {
|
|
48
48
|
return !isSocketPath( path )
|
|
49
49
|
}
|
|
@@ -25,7 +25,7 @@ import { isSocketPath } from './isSocketPath'
|
|
|
25
25
|
* @param data {*} The data to check against the socket path type
|
|
26
26
|
* @returns {boolean} true if data is a valid socket path, false otherwise
|
|
27
27
|
*/
|
|
28
|
-
export function isValidSocketPath
|
|
28
|
+
export function isValidSocketPath( data ) {
|
|
29
29
|
return ( isValidPath( data ) && isSocketPath( data ) )
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,6 +35,6 @@ export function isValidSocketPath ( data ) {
|
|
|
35
35
|
* @param data {*} The data to check against the socket path type
|
|
36
36
|
* @returns {boolean} true if data is an invalid socket path, false otherwise
|
|
37
37
|
*/
|
|
38
|
-
export function isInvalidSocketPath
|
|
38
|
+
export function isInvalidSocketPath( data ) {
|
|
39
39
|
return !isValidSocketPath( data )
|
|
40
40
|
}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import
|
|
23
|
-
import { isDefined }
|
|
24
|
-
import {isNotString} from '../../cores/strings/isString'
|
|
22
|
+
import { statSync } from 'fs'
|
|
23
|
+
import { isDefined } from '../../cores/voids/isDefined'
|
|
24
|
+
import { isNotString } from '../../cores/strings/isString'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Check if given path is a symbolic link path
|
|
@@ -29,13 +29,13 @@ import {isNotString} from '../../cores/strings/isString';
|
|
|
29
29
|
* @param path {string|Buffer|URL} The data to check against the symbolic link path type
|
|
30
30
|
* @returns {boolean} true if path is a symbolic link path, false otherwise
|
|
31
31
|
*/
|
|
32
|
-
export function isSymbolicLinkPath
|
|
33
|
-
if( isNotString(path) && !(path instanceof Buffer) && !(path instanceof URL) ) {
|
|
34
|
-
throw new TypeError('Invalid path type! Expect string, buffer or url.')
|
|
32
|
+
export function isSymbolicLinkPath( path ) {
|
|
33
|
+
if ( isNotString( path ) && !( path instanceof Buffer ) && !( path instanceof URL ) ) {
|
|
34
|
+
throw new TypeError( 'Invalid path type! Expect string, buffer or url.' )
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const stat =
|
|
38
|
-
return isDefined(stat) && stat.isSymbolicLink()
|
|
37
|
+
const stat = statSync( path, { throwIfNoEntry: false } )
|
|
38
|
+
return isDefined( stat ) && stat.isSymbolicLink()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -44,6 +44,6 @@ export function isSymbolicLinkPath ( path ) {
|
|
|
44
44
|
* @param path {string|Buffer|URL} The data to check against the symbolic link path type
|
|
45
45
|
* @returns {boolean} true if path is not a symbolic link path, false otherwise
|
|
46
46
|
*/
|
|
47
|
-
export function isNotSymbolicLinkPath
|
|
47
|
+
export function isNotSymbolicLinkPath( path ) {
|
|
48
48
|
return !isSymbolicLinkPath( path )
|
|
49
49
|
}
|
|
@@ -25,7 +25,7 @@ import { isSymbolicLinkPath } from './isSymbolicLinkPath'
|
|
|
25
25
|
* @param data {*} The data to check against the symbolic link path type
|
|
26
26
|
* @returns {boolean} true if data is a valid symbolic link path, false otherwise
|
|
27
27
|
*/
|
|
28
|
-
export function isValidSymbolicLinkPath
|
|
28
|
+
export function isValidSymbolicLinkPath( data ) {
|
|
29
29
|
return ( isValidPath( data ) && isSymbolicLinkPath( data ) )
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,6 +35,6 @@ export function isValidSymbolicLinkPath ( data ) {
|
|
|
35
35
|
* @param data {*} The data to check against the symbolic link path type
|
|
36
36
|
* @returns {boolean} true if data is an invalid symbolic link path, false otherwise
|
|
37
37
|
*/
|
|
38
|
-
export function isInvalidSymbolicLinkPath
|
|
38
|
+
export function isInvalidSymbolicLinkPath( data ) {
|
|
39
39
|
return !isValidSymbolicLinkPath( data )
|
|
40
40
|
}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* __________________________________________________________________________________________________________________________________________________________________________________________________
|
|
3
|
-
* _/\\\\\\\\\\\________________________________________________________/\\\________/\\\_________________/\\\\\\__________________/\\\_______________________________________________________________
|
|
4
|
-
* _\/////\\\///________________________________________________________\/\\\_______\/\\\________________\////\\\_________________\/\\\______________________________________________________________
|
|
5
|
-
* ______\/\\\_________/\\\______________________________________________\//\\\______/\\\____________________\/\\\_____/\\\________\/\\\_____________________/\\\____________________________________
|
|
6
|
-
* _______\/\\\______/\\\\\\\\\\\_____/\\\\\\\\______/\\\\\\\\_____________\//\\\____/\\\____/\\\\\\\\\_______\/\\\____\///_________\/\\\___/\\\\\\\\\_____/\\\\\\\\\\\_____/\\\\\_____/\\/\\\\\\\___
|
|
7
|
-
* ________\/\\\_____\////\\\////____/\\\/////\\\___/\\\/////\\\_____________\//\\\__/\\\____\////////\\\______\/\\\_____/\\\___/\\\\\\\\\__\////////\\\___\////\\\////____/\\\///\\\__\/\\\/////\\\_
|
|
8
|
-
* _________\/\\\________\/\\\_______/\\\\\\\\\\\___/\\\\\\\\\\\_______________\//\\\/\\\_______/\\\\\\\\\\_____\/\\\____\/\\\__/\\\////\\\____/\\\\\\\\\\_____\/\\\_______/\\\__\//\\\_\/\\\___\///_
|
|
9
|
-
* __________\/\\\________\/\\\_/\\__\//\\///////___\//\\///////_________________\//\\\\\_______/\\\/////\\\_____\/\\\____\/\\\_\/\\\__\/\\\___/\\\/////\\\_____\/\\\_/\\__\//\\\__/\\\__\/\\\_______
|
|
10
|
-
* ________/\\\\\\\\\\\____\//\\\\\____\//\\\\\\\\\\__\//\\\\\\\\\\________________\//\\\_______\//\\\\\\\\/\\__/\\\\\\\\\_\/\\\_\//\\\\\\\/\\_\//\\\\\\\\/\\____\//\\\\\____\///\\\\\/___\/\\\______
|
|
11
|
-
* ________\///////////______\/////______\//////////____\//////////__________________\///_________\////////\//__\/////////__\///___\///////\//___\////////\//______\/////_______\/////_____\///______
|
|
12
|
-
* __________________________________________________________________________________________________________________________________________________________________________________________________
|
|
13
|
-
*
|
|
14
2
|
* @author [Tristan Valcke]{@link https://github.com/Itee}
|
|
15
3
|
* @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}
|
|
16
4
|
*
|
|
17
5
|
* @module sources/itee-validators
|
|
18
6
|
* @description This is the main entry point to bundle the itee validators package.
|
|
19
|
-
* It
|
|
7
|
+
* It exposes all exports of the cores, maths and physics sub-folder.
|
|
20
8
|
* In case you're using the commons js build, you will get the file-system validators too.
|
|
21
|
-
*
|
|
22
9
|
*/
|
|
23
10
|
|
|
24
11
|
export * from './cores/_cores'
|
|
@@ -24,7 +24,7 @@ import { ABSOLUTE_ZERO_CELSIUS } from './constants'
|
|
|
24
24
|
* @param data {*}
|
|
25
25
|
* @return {boolean}
|
|
26
26
|
*/
|
|
27
|
-
export function isCelsius
|
|
27
|
+
export function isCelsius( data ) {
|
|
28
28
|
return ( isNumber( data ) && data >= ABSOLUTE_ZERO_CELSIUS )
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -33,6 +33,6 @@ export function isCelsius ( data ) {
|
|
|
33
33
|
* @param data {*}
|
|
34
34
|
* @return {boolean}
|
|
35
35
|
*/
|
|
36
|
-
export function isNotCelsius
|
|
36
|
+
export function isNotCelsius( data ) {
|
|
37
37
|
return !isCelsius( data )
|
|
38
38
|
}
|
|
@@ -24,7 +24,7 @@ import { ABSOLUTE_ZERO_FAHRENHEIT } from './constants'
|
|
|
24
24
|
* @param data {*}
|
|
25
25
|
* @return {boolean}
|
|
26
26
|
*/
|
|
27
|
-
export function isFahrenheit
|
|
27
|
+
export function isFahrenheit( data ) {
|
|
28
28
|
return ( isNumber( data ) && data >= ABSOLUTE_ZERO_FAHRENHEIT )
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -33,6 +33,6 @@ export function isFahrenheit ( data ) {
|
|
|
33
33
|
* @param data {*}
|
|
34
34
|
* @return {boolean}
|
|
35
35
|
*/
|
|
36
|
-
export function isNotFahrenheit
|
|
36
|
+
export function isNotFahrenheit( data ) {
|
|
37
37
|
return !isFahrenheit( data )
|
|
38
38
|
}
|
|
@@ -24,7 +24,7 @@ import { ABSOLUTE_ZERO_KELVIN } from './constants'
|
|
|
24
24
|
* @param data {*}
|
|
25
25
|
* @return {boolean}
|
|
26
26
|
*/
|
|
27
|
-
export function isKelvin
|
|
27
|
+
export function isKelvin( data ) {
|
|
28
28
|
return ( isNumber( data ) && data >= ABSOLUTE_ZERO_KELVIN )
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -33,6 +33,6 @@ export function isKelvin ( data ) {
|
|
|
33
33
|
* @param data {*}
|
|
34
34
|
* @return {boolean}
|
|
35
35
|
*/
|
|
36
|
-
export function isNotKelvin
|
|
36
|
+
export function isNotKelvin( data ) {
|
|
37
37
|
return !isKelvin( data )
|
|
38
38
|
}
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
* @param data {*}
|
|
35
35
|
* @return {boolean}
|
|
36
36
|
*/
|
|
37
|
-
export function isTemperature
|
|
37
|
+
export function isTemperature( data ) {
|
|
38
38
|
return ( isKelvin( data ) || isCelsius( data ) || isFahrenheit( data ) )
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -43,6 +43,6 @@ export function isTemperature ( data ) {
|
|
|
43
43
|
* @param data {*}
|
|
44
44
|
* @return {boolean}
|
|
45
45
|
*/
|
|
46
|
-
export function isNotTemperature
|
|
46
|
+
export function isNotTemperature( data ) {
|
|
47
47
|
return ( isNotKelvin( data ) && isNotCelsius( data ) && isNotFahrenheit( data ) )
|
|
48
48
|
}
|