@w3ux/utils 2.0.1 → 2.0.3

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
@@ -19,8 +19,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/base.ts
20
20
  var base_exports = {};
21
21
  __export(base_exports, {
22
- appendOr: () => appendOr,
23
- appendOrEmpty: () => appendOrEmpty,
24
22
  camelize: () => camelize,
25
23
  ellipsisFn: () => ellipsisFn,
26
24
  eqSet: () => eqSet,
@@ -136,8 +134,6 @@ var withTimeout = (ms, promise, options) => {
136
134
  );
137
135
  return Promise.race([promise, timeout]);
138
136
  };
139
- var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
140
- var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
141
137
  var formatAccountSs58 = (address, ss58Prefix) => {
142
138
  try {
143
139
  const codec = (0, import_substrate_bindings.AccountId)(ss58Prefix);
@@ -160,8 +156,6 @@ var maxBigInt = (...values) => values.reduce((max, current) => current > max ? c
160
156
  var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
161
157
  // Annotate the CommonJS export names for ESM import in node:
162
158
  0 && (module.exports = {
163
- appendOr,
164
- appendOrEmpty,
165
159
  camelize,
166
160
  ellipsisFn,
167
161
  eqSet,
package/base.d.cts CHANGED
@@ -1,5 +1,3 @@
1
- import { AnyFunction } from '@w3ux/types';
2
-
3
1
  /**
4
2
  * Ensures a number has at least the specified number of decimal places, retaining commas in the output if they are present in the input.
5
3
  *
@@ -57,19 +55,10 @@ declare const shuffle: <T>(array: T[]) => T[];
57
55
  * @name withTimeout
58
56
  * @summary Timeout a promise after a specified number of milliseconds.
59
57
  */
60
- declare const withTimeout: (ms: number, promise: AnyFunction, options?: {
61
- onTimeout?: AnyFunction;
62
- }) => Promise<any>;
63
- /**
64
- * @name appendOrEmpty
65
- * @summary Returns ` value` if a condition is truthy, or an empty string otherwise.
66
- */
67
- declare const appendOrEmpty: (condition: boolean | string | undefined, value: string) => string;
58
+ declare const withTimeout: (ms: number, promise: Promise<() => void>, options?: {
59
+ onTimeout?: () => void;
60
+ }) => Promise<unknown>;
68
61
  /**
69
- * @name appendOr
70
- * @summary Returns ` value` if condition is truthy, or ` fallback` otherwise.
71
- */
72
- declare const appendOr: (condition: boolean | string | undefined, value: string, fallback: string) => string;
73
62
  /**
74
63
  * @name formatAccountSs58
75
64
  * @summary Formats an address with the supplied ss58 prefix, or returns null if invalid.
@@ -106,4 +95,4 @@ declare const maxBigInt: (...values: bigint[]) => bigint;
106
95
  */
107
96
  declare const minBigInt: (...values: bigint[]) => bigint;
108
97
 
109
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout };
98
+ export { camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout };
package/base.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { AnyFunction } from '@w3ux/types';
2
-
3
1
  /**
4
2
  * Ensures a number has at least the specified number of decimal places, retaining commas in the output if they are present in the input.
5
3
  *
@@ -57,19 +55,10 @@ declare const shuffle: <T>(array: T[]) => T[];
57
55
  * @name withTimeout
58
56
  * @summary Timeout a promise after a specified number of milliseconds.
59
57
  */
60
- declare const withTimeout: (ms: number, promise: AnyFunction, options?: {
61
- onTimeout?: AnyFunction;
62
- }) => Promise<any>;
63
- /**
64
- * @name appendOrEmpty
65
- * @summary Returns ` value` if a condition is truthy, or an empty string otherwise.
66
- */
67
- declare const appendOrEmpty: (condition: boolean | string | undefined, value: string) => string;
58
+ declare const withTimeout: (ms: number, promise: Promise<() => void>, options?: {
59
+ onTimeout?: () => void;
60
+ }) => Promise<unknown>;
68
61
  /**
69
- * @name appendOr
70
- * @summary Returns ` value` if condition is truthy, or ` fallback` otherwise.
71
- */
72
- declare const appendOr: (condition: boolean | string | undefined, value: string, fallback: string) => string;
73
62
  /**
74
63
  * @name formatAccountSs58
75
64
  * @summary Formats an address with the supplied ss58 prefix, or returns null if invalid.
@@ -106,4 +95,4 @@ declare const maxBigInt: (...values: bigint[]) => bigint;
106
95
  */
107
96
  declare const minBigInt: (...values: bigint[]) => bigint;
108
97
 
109
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout };
98
+ export { camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout };
package/base.js CHANGED
@@ -98,8 +98,6 @@ var withTimeout = (ms, promise, options) => {
98
98
  );
99
99
  return Promise.race([promise, timeout]);
100
100
  };
101
- var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
102
- var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
103
101
  var formatAccountSs58 = (address, ss58Prefix) => {
104
102
  try {
105
103
  const codec = AccountId(ss58Prefix);
@@ -121,8 +119,6 @@ var isSuperset = (set, subset) => {
121
119
  var maxBigInt = (...values) => values.reduce((max, current) => current > max ? current : max);
122
120
  var minBigInt = (...values) => values.reduce((min, current) => current < min ? current : min);
123
121
  export {
124
- appendOr,
125
- appendOrEmpty,
126
122
  camelize,
127
123
  ellipsisFn,
128
124
  eqSet,
package/index.cjs CHANGED
@@ -20,8 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var src_exports = {};
21
21
  __export(src_exports, {
22
22
  addedTo: () => addedTo,
23
- appendOr: () => appendOr,
24
- appendOrEmpty: () => appendOrEmpty,
25
23
  applyWidthAsPadding: () => applyWidthAsPadding,
26
24
  camelize: () => camelize,
27
25
  capitalizeFirstLetter: () => capitalizeFirstLetter,
@@ -161,8 +159,6 @@ var withTimeout = (ms, promise, options) => {
161
159
  );
162
160
  return Promise.race([promise, timeout]);
163
161
  };
164
- var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
165
- var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
166
162
  var formatAccountSs58 = (address, ss58Prefix) => {
167
163
  try {
168
164
  const codec = (0, import_substrate_bindings.AccountId)(ss58Prefix);
@@ -397,8 +393,6 @@ var mergeDeep = (target, ...sources) => {
397
393
  // Annotate the CommonJS export names for ESM import in node:
398
394
  0 && (module.exports = {
399
395
  addedTo,
400
- appendOr,
401
- appendOrEmpty,
402
396
  applyWidthAsPadding,
403
397
  camelize,
404
398
  capitalizeFirstLetter,
package/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout } from './base.cjs';
1
+ export { camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout } from './base.cjs';
2
2
  export { u8aConcat } from './convert.cjs';
3
3
  export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash } from './unit.cjs';
4
- import '@w3ux/types';
5
4
  import 'react';
6
5
  import './types.cjs';
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout } from './base.js';
1
+ export { camelize, ellipsisFn, eqSet, formatAccountSs58, isSuperset, maxBigInt, minBigInt, minDecimalPlaces, pageFromUri, removeHexPrefix, rmCommas, rmDecimals, shuffle, withTimeout } from './base.js';
2
2
  export { u8aConcat } from './convert.js';
3
3
  export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash } from './unit.js';
4
- import '@w3ux/types';
5
4
  import 'react';
6
5
  import './types.js';
package/index.js CHANGED
@@ -98,8 +98,6 @@ var withTimeout = (ms, promise, options) => {
98
98
  );
99
99
  return Promise.race([promise, timeout]);
100
100
  };
101
- var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
102
- var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
103
101
  var formatAccountSs58 = (address, ss58Prefix) => {
104
102
  try {
105
103
  const codec = AccountId(ss58Prefix);
@@ -333,8 +331,6 @@ var mergeDeep = (target, ...sources) => {
333
331
  };
334
332
  export {
335
333
  addedTo,
336
- appendOr,
337
- appendOrEmpty,
338
334
  applyWidthAsPadding,
339
335
  camelize,
340
336
  capitalizeFirstLetter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w3ux/utils",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "license": "GPL-3.0-only",
5
5
  "dependencies": {
6
6
  "@polkadot-api/substrate-bindings": "^0.9.3"