@w3ux/utils 1.1.1-beta.1 → 1.1.1-beta.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.
- package/base.cjs +16 -0
- package/base.d.cts +9 -1
- package/base.d.ts +9 -1
- package/base.js +15 -0
- package/index.cjs +16 -0
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/index.js +15 -0
- package/package.json +1 -1
package/base.cjs
CHANGED
|
@@ -29,6 +29,7 @@ __export(base_exports, {
|
|
|
29
29
|
maxBigInt: () => maxBigInt,
|
|
30
30
|
minBigInt: () => minBigInt,
|
|
31
31
|
minDecimalPlaces: () => minDecimalPlaces,
|
|
32
|
+
objectSpread: () => objectSpread,
|
|
32
33
|
pageFromUri: () => pageFromUri,
|
|
33
34
|
removeHexPrefix: () => removeHexPrefix,
|
|
34
35
|
rmCommas: () => rmCommas,
|
|
@@ -156,6 +157,20 @@ var isSuperset = (set, subset) => {
|
|
|
156
157
|
};
|
|
157
158
|
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
158
159
|
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
160
|
+
function objectSpread(dest, ...sources) {
|
|
161
|
+
sources.forEach((src) => {
|
|
162
|
+
if (src) {
|
|
163
|
+
if (src && typeof src.entries === "function") {
|
|
164
|
+
Object.entries(src).forEach(([key, value]) => {
|
|
165
|
+
dest[key] = value;
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
Object.assign(dest, src);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return dest;
|
|
173
|
+
}
|
|
159
174
|
// Annotate the CommonJS export names for ESM import in node:
|
|
160
175
|
0 && (module.exports = {
|
|
161
176
|
appendOr,
|
|
@@ -168,6 +183,7 @@ var minBigInt = (...values) => values.reduce((min, current) => current < min ? c
|
|
|
168
183
|
maxBigInt,
|
|
169
184
|
minBigInt,
|
|
170
185
|
minDecimalPlaces,
|
|
186
|
+
objectSpread,
|
|
171
187
|
pageFromUri,
|
|
172
188
|
removeHexPrefix,
|
|
173
189
|
rmCommas,
|
package/base.d.cts
CHANGED
|
@@ -100,5 +100,13 @@ declare const maxBigInt: (...values: bigint[]) => bigint;
|
|
|
100
100
|
* minBigInt(10n, 50n, 30n, 100n, 20n); // 10n
|
|
101
101
|
*/
|
|
102
102
|
declare const minBigInt: (...values: bigint[]) => bigint;
|
|
103
|
+
/**
|
|
104
|
+
* @name objectSpread
|
|
105
|
+
* @summary Merges all source objects into the destination object.
|
|
106
|
+
* @param {T} dest - The destination object to be populated.
|
|
107
|
+
* @param {...Partial<T>} sources - The source objects to merge into the destination.
|
|
108
|
+
* @returns {T} The updated destination object.
|
|
109
|
+
*/
|
|
110
|
+
declare function objectSpread<T extends object>(dest: T, ...sources: Partial<T>[]): T;
|
|
103
111
|
|
|
104
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
|
112
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
package/base.d.ts
CHANGED
|
@@ -100,5 +100,13 @@ declare const maxBigInt: (...values: bigint[]) => bigint;
|
|
|
100
100
|
* minBigInt(10n, 50n, 30n, 100n, 20n); // 10n
|
|
101
101
|
*/
|
|
102
102
|
declare const minBigInt: (...values: bigint[]) => bigint;
|
|
103
|
+
/**
|
|
104
|
+
* @name objectSpread
|
|
105
|
+
* @summary Merges all source objects into the destination object.
|
|
106
|
+
* @param {T} dest - The destination object to be populated.
|
|
107
|
+
* @param {...Partial<T>} sources - The source objects to merge into the destination.
|
|
108
|
+
* @returns {T} The updated destination object.
|
|
109
|
+
*/
|
|
110
|
+
declare function objectSpread<T extends object>(dest: T, ...sources: Partial<T>[]): T;
|
|
103
111
|
|
|
104
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
|
112
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
|
package/base.js
CHANGED
|
@@ -119,6 +119,20 @@ var isSuperset = (set, subset) => {
|
|
|
119
119
|
};
|
|
120
120
|
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
121
121
|
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
122
|
+
function objectSpread(dest, ...sources) {
|
|
123
|
+
sources.forEach((src) => {
|
|
124
|
+
if (src) {
|
|
125
|
+
if (src && typeof src.entries === "function") {
|
|
126
|
+
Object.entries(src).forEach(([key, value]) => {
|
|
127
|
+
dest[key] = value;
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
Object.assign(dest, src);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return dest;
|
|
135
|
+
}
|
|
122
136
|
export {
|
|
123
137
|
appendOr,
|
|
124
138
|
appendOrEmpty,
|
|
@@ -130,6 +144,7 @@ export {
|
|
|
130
144
|
maxBigInt,
|
|
131
145
|
minBigInt,
|
|
132
146
|
minDecimalPlaces,
|
|
147
|
+
objectSpread,
|
|
133
148
|
pageFromUri,
|
|
134
149
|
removeHexPrefix,
|
|
135
150
|
rmCommas,
|
package/index.cjs
CHANGED
|
@@ -51,6 +51,7 @@ __export(src_exports, {
|
|
|
51
51
|
mergeDeep: () => mergeDeep,
|
|
52
52
|
minBigInt: () => minBigInt,
|
|
53
53
|
minDecimalPlaces: () => minDecimalPlaces,
|
|
54
|
+
objectSpread: () => objectSpread,
|
|
54
55
|
pageFromUri: () => pageFromUri,
|
|
55
56
|
planckToUnit: () => planckToUnit,
|
|
56
57
|
remToUnit: () => remToUnit,
|
|
@@ -193,6 +194,20 @@ var isSuperset = (set, subset) => {
|
|
|
193
194
|
};
|
|
194
195
|
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
195
196
|
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
197
|
+
function objectSpread(dest, ...sources) {
|
|
198
|
+
sources.forEach((src) => {
|
|
199
|
+
if (src) {
|
|
200
|
+
if (src && typeof src.entries === "function") {
|
|
201
|
+
Object.entries(src).forEach(([key, value]) => {
|
|
202
|
+
dest[key] = value;
|
|
203
|
+
});
|
|
204
|
+
} else {
|
|
205
|
+
Object.assign(dest, src);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return dest;
|
|
210
|
+
}
|
|
196
211
|
|
|
197
212
|
// src/conversions.ts
|
|
198
213
|
var stringToU8a = (input) => {
|
|
@@ -590,6 +605,7 @@ var mergeDeep = (target, ...sources) => {
|
|
|
590
605
|
mergeDeep,
|
|
591
606
|
minBigInt,
|
|
592
607
|
minDecimalPlaces,
|
|
608
|
+
objectSpread,
|
|
593
609
|
pageFromUri,
|
|
594
610
|
planckToUnit,
|
|
595
611
|
remToUnit,
|
package/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.cjs';
|
|
1
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.cjs';
|
|
2
2
|
export { stringToU8a, u8aToString } from './conversions.cjs';
|
|
3
3
|
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash } from './unit.cjs';
|
|
4
4
|
import '@w3ux/types';
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.js';
|
|
1
|
+
export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout } from './base.js';
|
|
2
2
|
export { stringToU8a, u8aToString } from './conversions.js';
|
|
3
3
|
export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, determinePoolDisplay, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash } from './unit.js';
|
|
4
4
|
import '@w3ux/types';
|
package/index.js
CHANGED
|
@@ -119,6 +119,20 @@ var isSuperset = (set, subset) => {
|
|
|
119
119
|
};
|
|
120
120
|
var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
|
|
121
121
|
var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
|
|
122
|
+
function objectSpread(dest, ...sources) {
|
|
123
|
+
sources.forEach((src) => {
|
|
124
|
+
if (src) {
|
|
125
|
+
if (src && typeof src.entries === "function") {
|
|
126
|
+
Object.entries(src).forEach(([key, value]) => {
|
|
127
|
+
dest[key] = value;
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
Object.assign(dest, src);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return dest;
|
|
135
|
+
}
|
|
122
136
|
|
|
123
137
|
// src/conversions.ts
|
|
124
138
|
var stringToU8a = (input) => {
|
|
@@ -515,6 +529,7 @@ export {
|
|
|
515
529
|
mergeDeep,
|
|
516
530
|
minBigInt,
|
|
517
531
|
minDecimalPlaces,
|
|
532
|
+
objectSpread,
|
|
518
533
|
pageFromUri,
|
|
519
534
|
planckToUnit,
|
|
520
535
|
remToUnit,
|