@t007/utils 0.0.11 → 0.0.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/dist/index.cjs CHANGED
@@ -32,14 +32,14 @@ __export(index_exports, {
32
32
  initVScrollerator: () => initVScrollerator,
33
33
  isArr: () => isArr,
34
34
  isBool: () => isBool,
35
- isDef: () => import_utils.isDef,
35
+ isDef: () => isDef,
36
36
  isFunc: () => isFunc,
37
37
  isIter: () => isIter,
38
38
  isNum: () => isNum,
39
- isObj: () => import_utils2.isObj,
39
+ isObj: () => isObj,
40
40
  isSameURL: () => isSameURL,
41
41
  isStr: () => isStr,
42
- isStrictObj: () => import_utils2.isStrictObj,
42
+ isStrictObj: () => isStrictObj,
43
43
  isSym: () => isSym,
44
44
  loadResource: () => loadResource,
45
45
  onAllMethods: () => onAllMethods,
@@ -49,8 +49,9 @@ __export(index_exports, {
49
49
  module.exports = __toCommonJS(index_exports);
50
50
 
51
51
  // src/core/obj.ts
52
- var import_utils = require("sia-reactor/utils");
53
- var import_utils2 = require("sia-reactor/utils");
52
+ function isDef(val) {
53
+ return "undefined" !== typeof val;
54
+ }
54
55
  function isSym(val) {
55
56
  return "symbol" === typeof val;
56
57
  }
@@ -66,6 +67,12 @@ function isStr(val) {
66
67
  function isArr(obj) {
67
68
  return Array.isArray(obj);
68
69
  }
70
+ function isObj(obj, arraycheck = true) {
71
+ return "object" === typeof obj && obj !== null && (arraycheck ? !Array.isArray(obj) : true);
72
+ }
73
+ function isStrictObj(obj, crossRealms = false, typecheck = true) {
74
+ return (typecheck ? isObj(obj, false) : true) && (crossRealms ? Object.prototype.toString.call(obj) === "[object Object]" : obj.constructor === Object);
75
+ }
69
76
  function isIter(obj) {
70
77
  return obj != null && "function" === typeof obj[Symbol.iterator];
71
78
  }
@@ -261,7 +268,7 @@ function initScrollAssist(el, { pxPerSecond = 80, assistClassName = "tmg-video-c
261
268
  var removeScrollAssist = (el) => t007._scrollers.get(el)?.destroy();
262
269
 
263
270
  // src/index.ts
264
- if ((0, import_utils.isDef)(window)) {
271
+ if (isDef(window)) {
265
272
  window.t007 ??= {};
266
273
  t007.VIRTUAL_RESOURCE = VIRTUAL_RESOURCE;
267
274
  window.T007_TOAST_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest`;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,3 @@
1
- export { isDef, isObj, isStrictObj } from 'sia-reactor/utils';
2
-
3
1
  interface ScrolleratorOptions {
4
2
  baseSpeed?: number;
5
3
  maxSpeed?: number;
@@ -52,12 +50,14 @@ declare global {
52
50
  var t007: T007Namespace;
53
51
  }
54
52
 
53
+ declare function isDef(val: any): boolean;
55
54
  declare function isSym<T extends symbol = symbol>(val: any): val is T;
56
55
  declare function isBool<T extends boolean = boolean>(val: any): val is T;
57
56
  declare function isNum<T extends number = number>(val: any): val is T;
58
57
  declare function isStr<T extends string = string>(val: any): val is T;
59
58
  declare function isArr<T = unknown>(obj: any): obj is T[];
60
-
59
+ declare function isObj<T extends object = object>(obj: any, arraycheck?: boolean): obj is T;
60
+ declare function isStrictObj<T extends object = object>(obj: any, crossRealms?: boolean, typecheck?: boolean): obj is T;
61
61
  declare function isIter<T = unknown>(obj: any): obj is Iterable<T>;
62
62
  declare function isFunc<T extends Function = Function>(val: any): val is T;
63
63
  declare function inBoolArrOpt(opt: any, str: string): boolean;
@@ -93,4 +93,4 @@ declare function bindAllMethods(owner: any): void;
93
93
  declare function guardAllMethods(owner: any, guardFn?: (fn: Function) => Function, bound?: boolean): void;
94
94
  declare function guardMethod<T extends Function>(fn: T, onError?: (e: any) => void): T;
95
95
 
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 };
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, isDef, isFunc, isIter, isNum, isObj, isSameURL, isStr, isStrictObj, isSym, loadResource, onAllMethods, removeScrollAssist, uid };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { isDef, isObj, isStrictObj } from 'sia-reactor/utils';
2
-
3
1
  interface ScrolleratorOptions {
4
2
  baseSpeed?: number;
5
3
  maxSpeed?: number;
@@ -52,12 +50,14 @@ declare global {
52
50
  var t007: T007Namespace;
53
51
  }
54
52
 
53
+ declare function isDef(val: any): boolean;
55
54
  declare function isSym<T extends symbol = symbol>(val: any): val is T;
56
55
  declare function isBool<T extends boolean = boolean>(val: any): val is T;
57
56
  declare function isNum<T extends number = number>(val: any): val is T;
58
57
  declare function isStr<T extends string = string>(val: any): val is T;
59
58
  declare function isArr<T = unknown>(obj: any): obj is T[];
60
-
59
+ declare function isObj<T extends object = object>(obj: any, arraycheck?: boolean): obj is T;
60
+ declare function isStrictObj<T extends object = object>(obj: any, crossRealms?: boolean, typecheck?: boolean): obj is T;
61
61
  declare function isIter<T = unknown>(obj: any): obj is Iterable<T>;
62
62
  declare function isFunc<T extends Function = Function>(val: any): val is T;
63
63
  declare function inBoolArrOpt(opt: any, str: string): boolean;
@@ -93,4 +93,4 @@ declare function bindAllMethods(owner: any): void;
93
93
  declare function guardAllMethods(owner: any, guardFn?: (fn: Function) => Function, bound?: boolean): void;
94
94
  declare function guardMethod<T extends Function>(fn: T, onError?: (e: any) => void): T;
95
95
 
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 };
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, isDef, isFunc, isIter, isNum, isObj, isSameURL, isStr, isStrictObj, isSym, loadResource, onAllMethods, removeScrollAssist, uid };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/core/obj.ts
2
- import { isDef } from "sia-reactor/utils";
3
- import { isObj, isStrictObj } from "sia-reactor/utils";
2
+ function isDef(val) {
3
+ return "undefined" !== typeof val;
4
+ }
4
5
  function isSym(val) {
5
6
  return "symbol" === typeof val;
6
7
  }
@@ -16,6 +17,12 @@ function isStr(val) {
16
17
  function isArr(obj) {
17
18
  return Array.isArray(obj);
18
19
  }
20
+ function isObj(obj, arraycheck = true) {
21
+ return "object" === typeof obj && obj !== null && (arraycheck ? !Array.isArray(obj) : true);
22
+ }
23
+ function isStrictObj(obj, crossRealms = false, typecheck = true) {
24
+ return (typecheck ? isObj(obj, false) : true) && (crossRealms ? Object.prototype.toString.call(obj) === "[object Object]" : obj.constructor === Object);
25
+ }
19
26
  function isIter(obj) {
20
27
  return obj != null && "function" === typeof obj[Symbol.iterator];
21
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t007/utils",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
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",
@@ -43,8 +43,5 @@
43
43
  "dom-manipulation",
44
44
  "shared-logic",
45
45
  "performance"
46
- ],
47
- "dependencies": {
48
- "sia-reactor": "^0.0.12"
49
- }
46
+ ]
50
47
  }