@kopexa/shared-utils 1.1.3 → 1.1.4
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11 -0
- package/dist/index.mjs +10 -0
- package/dist/object.d.mts +4 -0
- package/dist/object.d.ts +4 -0
- package/dist/object.js +36 -0
- package/dist/object.mjs +11 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ export { ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isOb
|
|
|
2
2
|
export { cn } from './clsx.mjs';
|
|
3
3
|
export { getUniqueID } from './functions.mjs';
|
|
4
4
|
export { clamp } from './numbers.mjs';
|
|
5
|
+
export { compact } from './object.mjs';
|
|
5
6
|
export { chain } from './ra.mjs';
|
|
6
7
|
export { getInitials, safeText } from './text.mjs';
|
|
7
8
|
import 'clsx';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isOb
|
|
|
2
2
|
export { cn } from './clsx.js';
|
|
3
3
|
export { getUniqueID } from './functions.js';
|
|
4
4
|
export { clamp } from './numbers.js';
|
|
5
|
+
export { compact } from './object.js';
|
|
5
6
|
export { chain } from './ra.js';
|
|
6
7
|
export { getInitials, safeText } from './text.js';
|
|
7
8
|
import 'clsx';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
chain: () => chain,
|
|
25
25
|
clamp: () => clamp,
|
|
26
26
|
cn: () => cn,
|
|
27
|
+
compact: () => compact,
|
|
27
28
|
dataAttr: () => dataAttr,
|
|
28
29
|
getInitials: () => getInitials,
|
|
29
30
|
getUniqueID: () => getUniqueID,
|
|
@@ -76,6 +77,15 @@ function clamp(value, min, max) {
|
|
|
76
77
|
return Math.min(Math.max(value, min), max);
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
// src/object.ts
|
|
81
|
+
function compact(object) {
|
|
82
|
+
const clone = Object.assign({}, object);
|
|
83
|
+
for (const key in clone) {
|
|
84
|
+
if (clone[key] === void 0) delete clone[key];
|
|
85
|
+
}
|
|
86
|
+
return clone;
|
|
87
|
+
}
|
|
88
|
+
|
|
79
89
|
// src/ra.ts
|
|
80
90
|
function chain(...callbacks) {
|
|
81
91
|
return (...args) => {
|
|
@@ -107,6 +117,7 @@ var getInitials = (text) => {
|
|
|
107
117
|
chain,
|
|
108
118
|
clamp,
|
|
109
119
|
cn,
|
|
120
|
+
compact,
|
|
110
121
|
dataAttr,
|
|
111
122
|
getInitials,
|
|
112
123
|
getUniqueID,
|
package/dist/index.mjs
CHANGED
|
@@ -38,6 +38,15 @@ function clamp(value, min, max) {
|
|
|
38
38
|
return Math.min(Math.max(value, min), max);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// src/object.ts
|
|
42
|
+
function compact(object) {
|
|
43
|
+
const clone = Object.assign({}, object);
|
|
44
|
+
for (const key in clone) {
|
|
45
|
+
if (clone[key] === void 0) delete clone[key];
|
|
46
|
+
}
|
|
47
|
+
return clone;
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
// src/ra.ts
|
|
42
51
|
function chain(...callbacks) {
|
|
43
52
|
return (...args) => {
|
|
@@ -68,6 +77,7 @@ export {
|
|
|
68
77
|
chain,
|
|
69
78
|
clamp,
|
|
70
79
|
cn,
|
|
80
|
+
compact,
|
|
71
81
|
dataAttr,
|
|
72
82
|
getInitials,
|
|
73
83
|
getUniqueID,
|
package/dist/object.d.ts
ADDED
package/dist/object.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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/object.ts
|
|
21
|
+
var object_exports = {};
|
|
22
|
+
__export(object_exports, {
|
|
23
|
+
compact: () => compact
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(object_exports);
|
|
26
|
+
function compact(object) {
|
|
27
|
+
const clone = Object.assign({}, object);
|
|
28
|
+
for (const key in clone) {
|
|
29
|
+
if (clone[key] === void 0) delete clone[key];
|
|
30
|
+
}
|
|
31
|
+
return clone;
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
compact
|
|
36
|
+
});
|
package/dist/object.mjs
ADDED