@kopexa/shared-utils 1.1.0 → 1.1.2

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.
@@ -0,0 +1,11 @@
1
+ type Dict<T = unknown> = Record<string, T>;
2
+ declare function isArray<T>(value: unknown): value is Array<T>;
3
+ declare function isEmptyArray(value: unknown): boolean;
4
+ declare function isObject(value: unknown): value is Dict;
5
+ declare function isEmptyObject(value: unknown): boolean;
6
+ declare function isEmpty(value: unknown): boolean;
7
+ type Booleanish = boolean | "true" | "false";
8
+ declare const dataAttr: (condition: boolean | undefined) => Booleanish;
9
+ declare const ariaAttr: (condition: boolean | undefined) => Booleanish;
10
+
11
+ export { type Dict, ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isObject };
@@ -0,0 +1,11 @@
1
+ type Dict<T = unknown> = Record<string, T>;
2
+ declare function isArray<T>(value: unknown): value is Array<T>;
3
+ declare function isEmptyArray(value: unknown): boolean;
4
+ declare function isObject(value: unknown): value is Dict;
5
+ declare function isEmptyObject(value: unknown): boolean;
6
+ declare function isEmpty(value: unknown): boolean;
7
+ type Booleanish = boolean | "true" | "false";
8
+ declare const dataAttr: (condition: boolean | undefined) => Booleanish;
9
+ declare const ariaAttr: (condition: boolean | undefined) => Booleanish;
10
+
11
+ export { type Dict, ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isObject };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/assertion.ts
21
+ var assertion_exports = {};
22
+ __export(assertion_exports, {
23
+ ariaAttr: () => ariaAttr,
24
+ dataAttr: () => dataAttr,
25
+ isArray: () => isArray,
26
+ isEmpty: () => isEmpty,
27
+ isEmptyArray: () => isEmptyArray,
28
+ isEmptyObject: () => isEmptyObject,
29
+ isObject: () => isObject
30
+ });
31
+ module.exports = __toCommonJS(assertion_exports);
32
+ function isArray(value) {
33
+ return Array.isArray(value);
34
+ }
35
+ function isEmptyArray(value) {
36
+ return isArray(value) && value.length === 0;
37
+ }
38
+ function isObject(value) {
39
+ const type = typeof value;
40
+ return value != null && (type === "object" || type === "function") && !isArray(value);
41
+ }
42
+ function isEmptyObject(value) {
43
+ return isObject(value) && Object.keys(value).length === 0;
44
+ }
45
+ function isEmpty(value) {
46
+ if (isArray(value)) return isEmptyArray(value);
47
+ if (isObject(value)) return isEmptyObject(value);
48
+ if (value == null || value === "") return true;
49
+ return false;
50
+ }
51
+ var dataAttr = (condition) => condition ? "true" : void 0;
52
+ var ariaAttr = (condition) => condition ? "true" : void 0;
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ ariaAttr,
56
+ dataAttr,
57
+ isArray,
58
+ isEmpty,
59
+ isEmptyArray,
60
+ isEmptyObject,
61
+ isObject
62
+ });
@@ -0,0 +1,31 @@
1
+ // src/assertion.ts
2
+ function isArray(value) {
3
+ return Array.isArray(value);
4
+ }
5
+ function isEmptyArray(value) {
6
+ return isArray(value) && value.length === 0;
7
+ }
8
+ function isObject(value) {
9
+ const type = typeof value;
10
+ return value != null && (type === "object" || type === "function") && !isArray(value);
11
+ }
12
+ function isEmptyObject(value) {
13
+ return isObject(value) && Object.keys(value).length === 0;
14
+ }
15
+ function isEmpty(value) {
16
+ if (isArray(value)) return isEmptyArray(value);
17
+ if (isObject(value)) return isEmptyObject(value);
18
+ if (value == null || value === "") return true;
19
+ return false;
20
+ }
21
+ var dataAttr = (condition) => condition ? "true" : void 0;
22
+ var ariaAttr = (condition) => condition ? "true" : void 0;
23
+ export {
24
+ ariaAttr,
25
+ dataAttr,
26
+ isArray,
27
+ isEmpty,
28
+ isEmptyArray,
29
+ isEmptyObject,
30
+ isObject
31
+ };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
+ export { ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isObject } from './assertion.mjs';
1
2
  export { cn } from './clsx.mjs';
2
3
  export { getUniqueID } from './functions.mjs';
3
4
  export { clamp } from './numbers.mjs';
5
+ export { chain } from './ra.mjs';
4
6
  import 'clsx';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export { ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isObject } from './assertion.js';
1
2
  export { cn } from './clsx.js';
2
3
  export { getUniqueID } from './functions.js';
3
4
  export { clamp } from './numbers.js';
5
+ export { chain } from './ra.js';
4
6
  import 'clsx';
package/dist/index.js CHANGED
@@ -20,12 +20,43 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ariaAttr: () => ariaAttr,
24
+ chain: () => chain,
23
25
  clamp: () => clamp,
24
26
  cn: () => cn,
25
- getUniqueID: () => getUniqueID
27
+ dataAttr: () => dataAttr,
28
+ getUniqueID: () => getUniqueID,
29
+ isArray: () => isArray,
30
+ isEmpty: () => isEmpty,
31
+ isEmptyArray: () => isEmptyArray,
32
+ isEmptyObject: () => isEmptyObject,
33
+ isObject: () => isObject
26
34
  });
27
35
  module.exports = __toCommonJS(index_exports);
28
36
 
37
+ // src/assertion.ts
38
+ function isArray(value) {
39
+ return Array.isArray(value);
40
+ }
41
+ function isEmptyArray(value) {
42
+ return isArray(value) && value.length === 0;
43
+ }
44
+ function isObject(value) {
45
+ const type = typeof value;
46
+ return value != null && (type === "object" || type === "function") && !isArray(value);
47
+ }
48
+ function isEmptyObject(value) {
49
+ return isObject(value) && Object.keys(value).length === 0;
50
+ }
51
+ function isEmpty(value) {
52
+ if (isArray(value)) return isEmptyArray(value);
53
+ if (isObject(value)) return isEmptyObject(value);
54
+ if (value == null || value === "") return true;
55
+ return false;
56
+ }
57
+ var dataAttr = (condition) => condition ? "true" : void 0;
58
+ var ariaAttr = (condition) => condition ? "true" : void 0;
59
+
29
60
  // src/clsx.ts
30
61
  var import_clsx = require("clsx");
31
62
  var import_tailwind_merge = require("tailwind-merge");
@@ -42,9 +73,28 @@ function getUniqueID(prefix) {
42
73
  function clamp(value, min, max) {
43
74
  return Math.min(Math.max(value, min), max);
44
75
  }
76
+
77
+ // src/ra.ts
78
+ function chain(...callbacks) {
79
+ return (...args) => {
80
+ for (const callback of callbacks) {
81
+ if (typeof callback === "function") {
82
+ callback(...args);
83
+ }
84
+ }
85
+ };
86
+ }
45
87
  // Annotate the CommonJS export names for ESM import in node:
46
88
  0 && (module.exports = {
89
+ ariaAttr,
90
+ chain,
47
91
  clamp,
48
92
  cn,
49
- getUniqueID
93
+ dataAttr,
94
+ getUniqueID,
95
+ isArray,
96
+ isEmpty,
97
+ isEmptyArray,
98
+ isEmptyObject,
99
+ isObject
50
100
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,26 @@
1
+ // src/assertion.ts
2
+ function isArray(value) {
3
+ return Array.isArray(value);
4
+ }
5
+ function isEmptyArray(value) {
6
+ return isArray(value) && value.length === 0;
7
+ }
8
+ function isObject(value) {
9
+ const type = typeof value;
10
+ return value != null && (type === "object" || type === "function") && !isArray(value);
11
+ }
12
+ function isEmptyObject(value) {
13
+ return isObject(value) && Object.keys(value).length === 0;
14
+ }
15
+ function isEmpty(value) {
16
+ if (isArray(value)) return isEmptyArray(value);
17
+ if (isObject(value)) return isEmptyObject(value);
18
+ if (value == null || value === "") return true;
19
+ return false;
20
+ }
21
+ var dataAttr = (condition) => condition ? "true" : void 0;
22
+ var ariaAttr = (condition) => condition ? "true" : void 0;
23
+
1
24
  // src/clsx.ts
2
25
  import { clsx } from "clsx";
3
26
  import { twMerge } from "tailwind-merge";
@@ -14,8 +37,27 @@ function getUniqueID(prefix) {
14
37
  function clamp(value, min, max) {
15
38
  return Math.min(Math.max(value, min), max);
16
39
  }
40
+
41
+ // src/ra.ts
42
+ function chain(...callbacks) {
43
+ return (...args) => {
44
+ for (const callback of callbacks) {
45
+ if (typeof callback === "function") {
46
+ callback(...args);
47
+ }
48
+ }
49
+ };
50
+ }
17
51
  export {
52
+ ariaAttr,
53
+ chain,
18
54
  clamp,
19
55
  cn,
20
- getUniqueID
56
+ dataAttr,
57
+ getUniqueID,
58
+ isArray,
59
+ isEmpty,
60
+ isEmptyArray,
61
+ isEmptyObject,
62
+ isObject
21
63
  };
package/dist/ra.d.mts ADDED
@@ -0,0 +1,7 @@
1
+ /** biome-ignore-all lint/suspicious/noExplicitAny: ulitities are allowed */
2
+ /**
3
+ * Calls all functions in the order they were chained with the same arguments.
4
+ */
5
+ declare function chain(...callbacks: any[]): (...args: any[]) => void;
6
+
7
+ export { chain };
package/dist/ra.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /** biome-ignore-all lint/suspicious/noExplicitAny: ulitities are allowed */
2
+ /**
3
+ * Calls all functions in the order they were chained with the same arguments.
4
+ */
5
+ declare function chain(...callbacks: any[]): (...args: any[]) => void;
6
+
7
+ export { chain };
package/dist/ra.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/ra.ts
21
+ var ra_exports = {};
22
+ __export(ra_exports, {
23
+ chain: () => chain
24
+ });
25
+ module.exports = __toCommonJS(ra_exports);
26
+ function chain(...callbacks) {
27
+ return (...args) => {
28
+ for (const callback of callbacks) {
29
+ if (typeof callback === "function") {
30
+ callback(...args);
31
+ }
32
+ }
33
+ };
34
+ }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ chain
38
+ });
package/dist/ra.mjs ADDED
@@ -0,0 +1,13 @@
1
+ // src/ra.ts
2
+ function chain(...callbacks) {
3
+ return (...args) => {
4
+ for (const callback of callbacks) {
5
+ if (typeof callback === "function") {
6
+ callback(...args);
7
+ }
8
+ }
9
+ };
10
+ }
11
+ export {
12
+ chain
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopexa/shared-utils",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A set of kopexa shared utilities",
5
5
  "keywords": [
6
6
  "system"