@t007/utils 0.0.9 → 0.0.11
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/dist/index.cjs +6 -2
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
initScrollAssist: () => initScrollAssist,
|
|
32
32
|
initVScrollerator: () => initVScrollerator,
|
|
33
33
|
isArr: () => isArr,
|
|
34
|
+
isBool: () => isBool,
|
|
34
35
|
isDef: () => import_utils.isDef,
|
|
35
36
|
isFunc: () => isFunc,
|
|
36
37
|
isIter: () => isIter,
|
|
@@ -53,6 +54,9 @@ var import_utils2 = require("sia-reactor/utils");
|
|
|
53
54
|
function isSym(val) {
|
|
54
55
|
return "symbol" === typeof val;
|
|
55
56
|
}
|
|
57
|
+
function isBool(val) {
|
|
58
|
+
return "boolean" === typeof val;
|
|
59
|
+
}
|
|
56
60
|
function isNum(val) {
|
|
57
61
|
return "number" === typeof val;
|
|
58
62
|
}
|
|
@@ -142,8 +146,7 @@ function onAllMethods(owner, callback) {
|
|
|
142
146
|
while (proto && proto !== Object.prototype) {
|
|
143
147
|
for (const method of Object.getOwnPropertyNames(proto)) {
|
|
144
148
|
if (method === "constructor") continue;
|
|
145
|
-
if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value))
|
|
146
|
-
callback(method, owner);
|
|
149
|
+
if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) callback(method, owner);
|
|
147
150
|
}
|
|
148
151
|
proto = Object.getPrototypeOf(proto);
|
|
149
152
|
}
|
|
@@ -281,6 +284,7 @@ if ((0, import_utils.isDef)(window)) {
|
|
|
281
284
|
initScrollAssist,
|
|
282
285
|
initVScrollerator,
|
|
283
286
|
isArr,
|
|
287
|
+
isBool,
|
|
284
288
|
isDef,
|
|
285
289
|
isFunc,
|
|
286
290
|
isIter,
|
package/dist/index.d.cts
CHANGED
|
@@ -52,13 +52,14 @@ declare global {
|
|
|
52
52
|
var t007: T007Namespace;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
declare function isSym<T = symbol>(val: any): val is T;
|
|
56
|
-
declare function
|
|
57
|
-
declare function
|
|
55
|
+
declare function isSym<T extends symbol = symbol>(val: any): val is T;
|
|
56
|
+
declare function isBool<T extends boolean = boolean>(val: any): val is T;
|
|
57
|
+
declare function isNum<T extends number = number>(val: any): val is T;
|
|
58
|
+
declare function isStr<T extends string = string>(val: any): val is T;
|
|
58
59
|
declare function isArr<T = unknown>(obj: any): obj is T[];
|
|
59
60
|
|
|
60
61
|
declare function isIter<T = unknown>(obj: any): obj is Iterable<T>;
|
|
61
|
-
declare function isFunc<T = Function>(val: any): val is T;
|
|
62
|
+
declare function isFunc<T extends Function = Function>(val: any): val is T;
|
|
62
63
|
declare function inBoolArrOpt(opt: any, str: string): boolean;
|
|
63
64
|
|
|
64
65
|
declare function clamp(min: number | undefined, val: number, max?: number): number;
|
|
@@ -92,4 +93,4 @@ declare function bindAllMethods(owner: any): void;
|
|
|
92
93
|
declare function guardAllMethods(owner: any, guardFn?: (fn: Function) => Function, bound?: boolean): void;
|
|
93
94
|
declare function guardMethod<T extends Function>(fn: T, onError?: (e: any) => void): T;
|
|
94
95
|
|
|
95
|
-
export { type Dataset, type LoadResourceOptions, type ResourceType, type ScrollAssistControl, type Style, VIRTUAL_RESOURCE, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, inBoolArrOpt, initScrollAssist, initVScrollerator, isArr, isFunc, isIter, isNum, isSameURL, isStr, isSym, loadResource, onAllMethods, removeScrollAssist, uid };
|
|
96
|
+
export { type Dataset, type LoadResourceOptions, type ResourceType, type ScrollAssistControl, type Style, VIRTUAL_RESOURCE, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, inBoolArrOpt, initScrollAssist, initVScrollerator, isArr, isBool, isFunc, isIter, isNum, isSameURL, isStr, isSym, loadResource, onAllMethods, removeScrollAssist, uid };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,13 +52,14 @@ declare global {
|
|
|
52
52
|
var t007: T007Namespace;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
declare function isSym<T = symbol>(val: any): val is T;
|
|
56
|
-
declare function
|
|
57
|
-
declare function
|
|
55
|
+
declare function isSym<T extends symbol = symbol>(val: any): val is T;
|
|
56
|
+
declare function isBool<T extends boolean = boolean>(val: any): val is T;
|
|
57
|
+
declare function isNum<T extends number = number>(val: any): val is T;
|
|
58
|
+
declare function isStr<T extends string = string>(val: any): val is T;
|
|
58
59
|
declare function isArr<T = unknown>(obj: any): obj is T[];
|
|
59
60
|
|
|
60
61
|
declare function isIter<T = unknown>(obj: any): obj is Iterable<T>;
|
|
61
|
-
declare function isFunc<T = Function>(val: any): val is T;
|
|
62
|
+
declare function isFunc<T extends Function = Function>(val: any): val is T;
|
|
62
63
|
declare function inBoolArrOpt(opt: any, str: string): boolean;
|
|
63
64
|
|
|
64
65
|
declare function clamp(min: number | undefined, val: number, max?: number): number;
|
|
@@ -92,4 +93,4 @@ declare function bindAllMethods(owner: any): void;
|
|
|
92
93
|
declare function guardAllMethods(owner: any, guardFn?: (fn: Function) => Function, bound?: boolean): void;
|
|
93
94
|
declare function guardMethod<T extends Function>(fn: T, onError?: (e: any) => void): T;
|
|
94
95
|
|
|
95
|
-
export { type Dataset, type LoadResourceOptions, type ResourceType, type ScrollAssistControl, type Style, VIRTUAL_RESOURCE, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, inBoolArrOpt, initScrollAssist, initVScrollerator, isArr, isFunc, isIter, isNum, isSameURL, isStr, isSym, loadResource, onAllMethods, removeScrollAssist, uid };
|
|
96
|
+
export { type Dataset, type LoadResourceOptions, type ResourceType, type ScrollAssistControl, type Style, VIRTUAL_RESOURCE, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, inBoolArrOpt, initScrollAssist, initVScrollerator, isArr, isBool, isFunc, isIter, isNum, isSameURL, isStr, isSym, loadResource, onAllMethods, removeScrollAssist, uid };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,9 @@ import { isObj, isStrictObj } from "sia-reactor/utils";
|
|
|
4
4
|
function isSym(val) {
|
|
5
5
|
return "symbol" === typeof val;
|
|
6
6
|
}
|
|
7
|
+
function isBool(val) {
|
|
8
|
+
return "boolean" === typeof val;
|
|
9
|
+
}
|
|
7
10
|
function isNum(val) {
|
|
8
11
|
return "number" === typeof val;
|
|
9
12
|
}
|
|
@@ -93,8 +96,7 @@ function onAllMethods(owner, callback) {
|
|
|
93
96
|
while (proto && proto !== Object.prototype) {
|
|
94
97
|
for (const method of Object.getOwnPropertyNames(proto)) {
|
|
95
98
|
if (method === "constructor") continue;
|
|
96
|
-
if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value))
|
|
97
|
-
callback(method, owner);
|
|
99
|
+
if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) callback(method, owner);
|
|
98
100
|
}
|
|
99
101
|
proto = Object.getPrototypeOf(proto);
|
|
100
102
|
}
|
|
@@ -231,6 +233,7 @@ export {
|
|
|
231
233
|
initScrollAssist,
|
|
232
234
|
initVScrollerator,
|
|
233
235
|
isArr,
|
|
236
|
+
isBool,
|
|
234
237
|
isDef,
|
|
235
238
|
isFunc,
|
|
236
239
|
isIter,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t007/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "High-performance, zero-dependency utility functions for the t007 ecosystem.",
|
|
5
5
|
"author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"performance"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"sia-reactor": "^0.0.
|
|
48
|
+
"sia-reactor": "^0.0.12"
|
|
49
49
|
}
|
|
50
50
|
}
|