@w3ux/utils 1.1.1-beta.3 → 1.1.1-beta.5

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 CHANGED
@@ -34,6 +34,7 @@ __export(base_exports, {
34
34
  removeHexPrefix: () => removeHexPrefix,
35
35
  rmCommas: () => rmCommas,
36
36
  shuffle: () => shuffle,
37
+ u8aConcat: () => u8aConcat,
37
38
  withTimeout: () => withTimeout
38
39
  });
39
40
  module.exports = __toCommonJS(base_exports);
@@ -171,6 +172,16 @@ function objectSpread(dest, ...sources) {
171
172
  });
172
173
  return dest;
173
174
  }
175
+ var u8aConcat = (...u8as) => {
176
+ const totalLength = u8as.reduce((sum, u8a) => sum + u8a.length, 0);
177
+ const result = new Uint8Array(totalLength);
178
+ let offset = 0;
179
+ for (const u8a of u8as) {
180
+ result.set(u8a, offset);
181
+ offset += u8a.length;
182
+ }
183
+ return result;
184
+ };
174
185
  // Annotate the CommonJS export names for ESM import in node:
175
186
  0 && (module.exports = {
176
187
  appendOr,
@@ -188,6 +199,7 @@ function objectSpread(dest, ...sources) {
188
199
  removeHexPrefix,
189
200
  rmCommas,
190
201
  shuffle,
202
+ u8aConcat,
191
203
  withTimeout
192
204
  });
193
205
  /* @license Copyright 2024 w3ux authors & contributors
package/base.d.cts CHANGED
@@ -107,6 +107,13 @@ declare const minBigInt: (...values: bigint[]) => bigint;
107
107
  * @param {...Partial<T>} sources - The source objects to merge into the destination.
108
108
  * @returns {T} The updated destination object.
109
109
  */
110
- declare function objectSpread<T extends object>(dest: T, ...sources: (object | undefined | null)[]): T;
110
+ declare function objectSpread<T extends object>(dest: object, ...sources: (object | undefined | null)[]): T;
111
+ /**
112
+ * Concatenates multiple Uint8Array instances into a single Uint8Array.
113
+ *
114
+ * @param {Uint8Array[]} u8as - An array of Uint8Array instances to concatenate.
115
+ * @returns {Uint8Array} A new Uint8Array containing all the input arrays concatenated.
116
+ */
117
+ declare const u8aConcat: (...u8as: Uint8Array[]) => Uint8Array;
111
118
 
112
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
119
+ export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, u8aConcat, withTimeout };
package/base.d.ts CHANGED
@@ -107,6 +107,13 @@ declare const minBigInt: (...values: bigint[]) => bigint;
107
107
  * @param {...Partial<T>} sources - The source objects to merge into the destination.
108
108
  * @returns {T} The updated destination object.
109
109
  */
110
- declare function objectSpread<T extends object>(dest: T, ...sources: (object | undefined | null)[]): T;
110
+ declare function objectSpread<T extends object>(dest: object, ...sources: (object | undefined | null)[]): T;
111
+ /**
112
+ * Concatenates multiple Uint8Array instances into a single Uint8Array.
113
+ *
114
+ * @param {Uint8Array[]} u8as - An array of Uint8Array instances to concatenate.
115
+ * @returns {Uint8Array} A new Uint8Array containing all the input arrays concatenated.
116
+ */
117
+ declare const u8aConcat: (...u8as: Uint8Array[]) => Uint8Array;
111
118
 
112
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, withTimeout };
119
+ export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, pageFromUri, removeHexPrefix, rmCommas, shuffle, u8aConcat, withTimeout };
package/base.js CHANGED
@@ -133,6 +133,16 @@ function objectSpread(dest, ...sources) {
133
133
  });
134
134
  return dest;
135
135
  }
136
+ var u8aConcat = (...u8as) => {
137
+ const totalLength = u8as.reduce((sum, u8a) => sum + u8a.length, 0);
138
+ const result = new Uint8Array(totalLength);
139
+ let offset = 0;
140
+ for (const u8a of u8as) {
141
+ result.set(u8a, offset);
142
+ offset += u8a.length;
143
+ }
144
+ return result;
145
+ };
136
146
  export {
137
147
  appendOr,
138
148
  appendOrEmpty,
@@ -149,6 +159,7 @@ export {
149
159
  removeHexPrefix,
150
160
  rmCommas,
151
161
  shuffle,
162
+ u8aConcat,
152
163
  withTimeout
153
164
  };
154
165
  /* @license Copyright 2024 w3ux authors & contributors
package/index.cjs CHANGED
@@ -64,6 +64,7 @@ __export(src_exports, {
64
64
  snakeToCamel: () => snakeToCamel,
65
65
  sortWithNull: () => sortWithNull,
66
66
  stringToU8a: () => stringToU8a,
67
+ u8aConcat: () => u8aConcat,
67
68
  u8aToString: () => u8aToString,
68
69
  unescape: () => unescape,
69
70
  unimplemented: () => unimplemented,
@@ -208,6 +209,16 @@ function objectSpread(dest, ...sources) {
208
209
  });
209
210
  return dest;
210
211
  }
212
+ var u8aConcat = (...u8as) => {
213
+ const totalLength = u8as.reduce((sum, u8a) => sum + u8a.length, 0);
214
+ const result = new Uint8Array(totalLength);
215
+ let offset = 0;
216
+ for (const u8a of u8as) {
217
+ result.set(u8a, offset);
218
+ offset += u8a.length;
219
+ }
220
+ return result;
221
+ };
211
222
 
212
223
  // src/conversions.ts
213
224
  var stringToU8a = (input) => {
@@ -618,6 +629,7 @@ var mergeDeep = (target, ...sources) => {
618
629
  snakeToCamel,
619
630
  sortWithNull,
620
631
  stringToU8a,
632
+ u8aConcat,
621
633
  u8aToString,
622
634
  unescape,
623
635
  unimplemented,
package/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, objectSpread, 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, u8aConcat, 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, objectSpread, 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, u8aConcat, 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
@@ -133,6 +133,16 @@ function objectSpread(dest, ...sources) {
133
133
  });
134
134
  return dest;
135
135
  }
136
+ var u8aConcat = (...u8as) => {
137
+ const totalLength = u8as.reduce((sum, u8a) => sum + u8a.length, 0);
138
+ const result = new Uint8Array(totalLength);
139
+ let offset = 0;
140
+ for (const u8a of u8as) {
141
+ result.set(u8a, offset);
142
+ offset += u8a.length;
143
+ }
144
+ return result;
145
+ };
136
146
 
137
147
  // src/conversions.ts
138
148
  var stringToU8a = (input) => {
@@ -542,6 +552,7 @@ export {
542
552
  snakeToCamel,
543
553
  sortWithNull,
544
554
  stringToU8a,
555
+ u8aConcat,
545
556
  u8aToString,
546
557
  unescape,
547
558
  unimplemented,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w3ux/utils",
3
- "version": "1.1.1-beta.3",
3
+ "version": "1.1.1-beta.5",
4
4
  "license": "GPL-3.0-only",
5
5
  "dependencies": {
6
6
  "@polkadot-api/substrate-bindings": "^0.9.3"