@thi.ng/checks 3.4.11 → 3.4.12
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 +1 -1
- package/exists-not-null.js +4 -1
- package/exists.js +4 -1
- package/has-bigint.js +4 -1
- package/has-crypto.js +4 -1
- package/has-max-length.js +4 -1
- package/has-min-length.js +4 -1
- package/has-performance.js +4 -1
- package/has-wasm.js +4 -4
- package/has-webgl.js +10 -8
- package/has-websocket.js +4 -1
- package/implements-function.js +4 -1
- package/is-alphanum.js +8 -3
- package/is-array.js +4 -1
- package/is-arraylike.js +4 -1
- package/is-ascii.js +6 -12
- package/is-async-iterable.js +4 -1
- package/is-bigint.js +4 -1
- package/is-blob.js +4 -1
- package/is-boolean.js +4 -1
- package/is-chrome.js +4 -1
- package/is-data-url.js +4 -1
- package/is-date.js +4 -1
- package/is-even.js +4 -1
- package/is-false.js +4 -1
- package/is-file.js +4 -1
- package/is-firefox.js +4 -1
- package/is-float-string.js +4 -1
- package/is-function.js +4 -1
- package/is-generator.js +4 -7
- package/is-hex-color.js +4 -1
- package/is-hex.js +4 -1
- package/is-ie.js +4 -3
- package/is-in-range.js +4 -1
- package/is-int-string.js +4 -1
- package/is-int32.js +4 -1
- package/is-iterable.js +4 -1
- package/is-map.js +4 -1
- package/is-mobile.js +6 -2
- package/is-nan.js +4 -1
- package/is-negative.js +4 -1
- package/is-nil.js +4 -5
- package/is-node.js +4 -3
- package/is-not-string-iterable.js +4 -3
- package/is-null.js +4 -1
- package/is-number.js +4 -1
- package/is-numeric.js +6 -14
- package/is-object.js +4 -1
- package/is-odd.js +4 -1
- package/is-plain-object.js +6 -11
- package/is-positive.js +4 -1
- package/is-primitive.js +6 -8
- package/is-promise.js +4 -1
- package/is-promiselike.js +4 -2
- package/is-proto-path.js +7 -31
- package/is-regexp.js +4 -1
- package/is-safari.js +4 -3
- package/is-set.js +4 -1
- package/is-string.js +4 -1
- package/is-symbol.js +4 -1
- package/is-touch-event.js +4 -8
- package/is-transferable.js +4 -4
- package/is-true.js +4 -1
- package/is-typedarray.js +4 -10
- package/is-uint32.js +4 -1
- package/is-undefined.js +4 -1
- package/is-uuid.js +4 -1
- package/is-uuid4.js +4 -1
- package/is-zero.js +4 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
package/exists-not-null.js
CHANGED
package/exists.js
CHANGED
package/has-bigint.js
CHANGED
package/has-crypto.js
CHANGED
package/has-max-length.js
CHANGED
package/has-min-length.js
CHANGED
package/has-performance.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { isFunction } from "./is-function.js";
|
|
2
|
-
|
|
2
|
+
const hasPerformance = () => typeof performance !== "undefined" && isFunction(performance.now);
|
|
3
|
+
export {
|
|
4
|
+
hasPerformance
|
|
5
|
+
};
|
package/has-wasm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const hasWASM = () => typeof window !== "undefined" && typeof window["WebAssembly"] !== "undefined" || typeof global !== "undefined" && typeof global["WebAssembly"] !== "undefined";
|
|
2
|
+
export {
|
|
3
|
+
hasWASM
|
|
4
|
+
};
|
package/has-webgl.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const hasWebGL = () => {
|
|
2
|
+
try {
|
|
3
|
+
document.createElement("canvas").getContext("webgl");
|
|
4
|
+
return true;
|
|
5
|
+
} catch (e) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
hasWebGL
|
|
9
11
|
};
|
package/has-websocket.js
CHANGED
package/implements-function.js
CHANGED
package/is-alphanum.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const isAlpha = (x) => /^[a-z]+$/i.test(x);
|
|
2
|
+
const isAlphaNum = (x) => /^[a-z0-9]+$/i.test(x);
|
|
3
|
+
const isNumeric = (x) => /^[0-9]+$/.test(x);
|
|
4
|
+
export {
|
|
5
|
+
isAlpha,
|
|
6
|
+
isAlphaNum,
|
|
7
|
+
isNumeric
|
|
8
|
+
};
|
package/is-array.js
CHANGED
package/is-arraylike.js
CHANGED
package/is-ascii.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns true iff all chars are in printable ASCII range [0x20 .. 0x7e]
|
|
9
|
-
*
|
|
10
|
-
* @param x -
|
|
11
|
-
*/
|
|
12
|
-
export const isPrintableASCII = (x) => /^[\x20-\x7e]+$/.test(x);
|
|
1
|
+
const isASCII = (x) => /^[\x00-\x7f]+$/.test(x);
|
|
2
|
+
const isPrintableASCII = (x) => /^[\x20-\x7e]+$/.test(x);
|
|
3
|
+
export {
|
|
4
|
+
isASCII,
|
|
5
|
+
isPrintableASCII
|
|
6
|
+
};
|
package/is-async-iterable.js
CHANGED
package/is-bigint.js
CHANGED
package/is-blob.js
CHANGED
package/is-boolean.js
CHANGED
package/is-chrome.js
CHANGED
package/is-data-url.js
CHANGED
package/is-date.js
CHANGED
package/is-even.js
CHANGED
package/is-false.js
CHANGED
package/is-file.js
CHANGED
package/is-firefox.js
CHANGED
package/is-float-string.js
CHANGED
package/is-function.js
CHANGED
package/is-generator.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { implementsFunction } from "./implements-function.js";
|
|
2
2
|
import { isIterable } from "./is-iterable.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param x
|
|
8
|
-
*/
|
|
9
|
-
export const isGenerator = (x) => isIterable(x) && implementsFunction(x, "next");
|
|
3
|
+
const isGenerator = (x) => isIterable(x) && implementsFunction(x, "next");
|
|
4
|
+
export {
|
|
5
|
+
isGenerator
|
|
6
|
+
};
|
package/is-hex-color.js
CHANGED
package/is-hex.js
CHANGED
package/is-ie.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const isIE = () => typeof document !== "undefined" && (typeof document["documentMode"] !== "undefined" || navigator.userAgent.indexOf("MSIE") > 0);
|
|
2
|
+
export {
|
|
3
|
+
isIE
|
|
4
|
+
};
|
package/is-in-range.js
CHANGED
package/is-int-string.js
CHANGED
package/is-int32.js
CHANGED
package/is-iterable.js
CHANGED
package/is-map.js
CHANGED
package/is-mobile.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const isMobile = () => typeof navigator !== "undefined" && /mobile|tablet|ip(ad|hone|od)|android|silk|crios/i.test(
|
|
2
|
+
navigator.userAgent
|
|
3
|
+
);
|
|
4
|
+
export {
|
|
5
|
+
isMobile
|
|
6
|
+
};
|
package/is-nan.js
CHANGED
package/is-negative.js
CHANGED
package/is-nil.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const isNil = (x) => x == null;
|
|
1
|
+
const isNil = (x) => x == null;
|
|
2
|
+
export {
|
|
3
|
+
isNil
|
|
4
|
+
};
|
package/is-node.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const isNode = () => typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node !== "undefined";
|
|
2
|
+
export {
|
|
3
|
+
isNode
|
|
4
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const isNotStringAndIterable = (x) => x != null && typeof x !== "string" && typeof x[Symbol.iterator] === "function";
|
|
2
|
+
export {
|
|
3
|
+
isNotStringAndIterable
|
|
4
|
+
};
|
package/is-null.js
CHANGED
package/is-number.js
CHANGED
package/is-numeric.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const isNumericInt = (x) => /^[-+]?\d+$/.test(x);
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if given string only contains an integer or floating point
|
|
10
|
-
* number, optionally in scientific notiation (e.g. `-123.45e-6`).
|
|
11
|
-
*
|
|
12
|
-
* @param x -
|
|
13
|
-
*/
|
|
14
|
-
export const isNumericFloat = (x) => /^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(x);
|
|
1
|
+
const isNumericInt = (x) => /^[-+]?\d+$/.test(x);
|
|
2
|
+
const isNumericFloat = (x) => /^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(x);
|
|
3
|
+
export {
|
|
4
|
+
isNumericFloat,
|
|
5
|
+
isNumericInt
|
|
6
|
+
};
|
package/is-object.js
CHANGED
package/is-odd.js
CHANGED
package/is-plain-object.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
const OBJP = Object.getPrototypeOf;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const isPlainObject = (x) => {
|
|
9
|
-
let p;
|
|
10
|
-
return (x != null &&
|
|
11
|
-
typeof x === "object" &&
|
|
12
|
-
((p = OBJP(x)) === null || OBJP(p) === null));
|
|
2
|
+
const isPlainObject = (x) => {
|
|
3
|
+
let p;
|
|
4
|
+
return x != null && typeof x === "object" && ((p = OBJP(x)) === null || OBJP(p) === null);
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
isPlainObject
|
|
13
8
|
};
|
package/is-positive.js
CHANGED
package/is-primitive.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const t = typeof x;
|
|
8
|
-
return t === "string" || t === "number" || t === "boolean";
|
|
1
|
+
const isPrimitive = (x) => {
|
|
2
|
+
const t = typeof x;
|
|
3
|
+
return t === "string" || t === "number" || t === "boolean";
|
|
4
|
+
};
|
|
5
|
+
export {
|
|
6
|
+
isPrimitive
|
|
9
7
|
};
|
package/is-promise.js
CHANGED
package/is-promiselike.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { implementsFunction } from "./implements-function.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const isPromiseLike = (x) => x instanceof Promise || implementsFunction(x, "then") && implementsFunction(x, "catch");
|
|
3
|
+
export {
|
|
4
|
+
isPromiseLike
|
|
5
|
+
};
|
package/is-proto-path.js
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
import { isArray } from "./is-array.js";
|
|
2
2
|
import { isString } from "./is-string.js";
|
|
3
|
-
const ILLEGAL_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @param x -
|
|
11
|
-
*/
|
|
12
|
-
export const isIllegalKey = (x) => ILLEGAL_KEYS.has(x);
|
|
13
|
-
/**
|
|
14
|
-
* Returns true if given `path` contains any {@link ILLEGAL_KEYS}, i.e. could be
|
|
15
|
-
* used to poison the prototype chain of an object.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* If given an array, each item is considered a single sub-path property and
|
|
19
|
-
* will be checked as is. If given a string it will be split using "." as
|
|
20
|
-
* delimiter and each item checked as is (same way array paths are handled).
|
|
21
|
-
*
|
|
22
|
-
* Original discussion here, implementation updated to be more encompassing:
|
|
23
|
-
* https://github.com/thi-ng/umbrella/pull/273
|
|
24
|
-
*
|
|
25
|
-
* @param path -
|
|
26
|
-
*/
|
|
27
|
-
export const isProtoPath = (path) => isArray(path)
|
|
28
|
-
? path.some(isIllegalKey)
|
|
29
|
-
: isString(path)
|
|
30
|
-
? path.indexOf(".") !== -1
|
|
31
|
-
? path.split(".").some(isIllegalKey)
|
|
32
|
-
: isIllegalKey(path)
|
|
33
|
-
: false;
|
|
3
|
+
const ILLEGAL_KEYS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
4
|
+
const isIllegalKey = (x) => ILLEGAL_KEYS.has(x);
|
|
5
|
+
const isProtoPath = (path) => isArray(path) ? path.some(isIllegalKey) : isString(path) ? path.indexOf(".") !== -1 ? path.split(".").some(isIllegalKey) : isIllegalKey(path) : false;
|
|
6
|
+
export {
|
|
7
|
+
isIllegalKey,
|
|
8
|
+
isProtoPath
|
|
9
|
+
};
|
package/is-regexp.js
CHANGED
package/is-safari.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isChrome } from "./is-chrome.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const isSafari = () => typeof navigator !== "undefined" && /Safari/.test(navigator.userAgent) && !isChrome();
|
|
3
|
+
export {
|
|
4
|
+
isSafari
|
|
5
|
+
};
|
package/is-set.js
CHANGED
package/is-string.js
CHANGED
package/is-symbol.js
CHANGED
package/is-touch-event.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* @param e
|
|
7
|
-
*/
|
|
8
|
-
export const isTouchEvent = (e) => typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
|
|
1
|
+
const isTouchEvent = (e) => typeof TouchEvent !== "undefined" && e instanceof TouchEvent;
|
|
2
|
+
export {
|
|
3
|
+
isTouchEvent
|
|
4
|
+
};
|
package/is-transferable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const isTransferable = (x) => x instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && x instanceof SharedArrayBuffer || typeof MessagePort !== "undefined" && x instanceof MessagePort;
|
|
2
|
+
export {
|
|
3
|
+
isTransferable
|
|
4
|
+
};
|
package/is-true.js
CHANGED
package/is-typedarray.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
x instanceof Int32Array ||
|
|
6
|
-
x instanceof Uint8Array ||
|
|
7
|
-
x instanceof Int8Array ||
|
|
8
|
-
x instanceof Uint16Array ||
|
|
9
|
-
x instanceof Int16Array ||
|
|
10
|
-
x instanceof Uint8ClampedArray);
|
|
1
|
+
const isTypedArray = (x) => !!x && (x instanceof Float32Array || x instanceof Float64Array || x instanceof Uint32Array || x instanceof Int32Array || x instanceof Uint8Array || x instanceof Int8Array || x instanceof Uint16Array || x instanceof Int16Array || x instanceof Uint8ClampedArray);
|
|
2
|
+
export {
|
|
3
|
+
isTypedArray
|
|
4
|
+
};
|
package/is-uint32.js
CHANGED
package/is-undefined.js
CHANGED
package/is-uuid.js
CHANGED
package/is-uuid4.js
CHANGED
package/is-zero.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/checks",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.12",
|
|
4
4
|
"description": "Collection of 70+ type, feature & value checks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"scripts": {
|
|
31
|
-
"build": "yarn
|
|
31
|
+
"build": "yarn build:esbuild && yarn build:decl",
|
|
32
|
+
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
33
|
+
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
32
34
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
|
|
33
35
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
34
36
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@microsoft/api-extractor": "^7.38.3",
|
|
44
46
|
"@types/node": "^20.10.2",
|
|
47
|
+
"esbuild": "^0.19.8",
|
|
45
48
|
"rimraf": "^5.0.5",
|
|
46
49
|
"tools": "^0.0.1",
|
|
47
50
|
"typedoc": "^0.25.4",
|
|
@@ -277,5 +280,5 @@
|
|
|
277
280
|
"default": "./is-zero.js"
|
|
278
281
|
}
|
|
279
282
|
},
|
|
280
|
-
"gitHead": "
|
|
283
|
+
"gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
|
|
281
284
|
}
|