@w3ux/utils 2.0.7-alpha.1 → 2.0.7-alpha.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/index.d.cts CHANGED
@@ -2,3 +2,4 @@ export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58
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
4
  import 'react';
5
+ import './types.cjs';
package/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { appendOr, appendOrEmpty, camelize, ellipsisFn, eqSet, formatAccountSs58
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
4
  import 'react';
5
+ import './types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w3ux/utils",
3
- "version": "2.0.7-alpha.1",
3
+ "version": "2.0.7-alpha.2",
4
4
  "license": "GPL-3.0-only",
5
5
  "dependencies": {
6
6
  "@polkadot-api/substrate-bindings": "^0.11.1"
package/unit.d.cts CHANGED
@@ -1,4 +1,5 @@
1
- import { RefObject } from 'react';
1
+ import { MutableRefObject, RefObject } from 'react';
2
+ import { AnyObject } from './types.cjs';
2
3
 
3
4
  /**
4
5
  * Converts an on-chain balance value from planck to a decimal value in token units.
@@ -43,7 +44,7 @@ declare const snakeToCamel: (str: string) => string;
43
44
  * @name setStateWithRef
44
45
  * @summary Synchronize React state and its reference with the provided value.
45
46
  */
46
- declare const setStateWithRef: <T>(value: T, setState: (_state: T) => void, ref: RefObject<T>) => void;
47
+ declare const setStateWithRef: <T>(value: T, setState: (_state: T) => void, ref: MutableRefObject<T>) => void;
47
48
  /**
48
49
  * @name localStorageOrDefault
49
50
  * @summary Retrieve the local stroage value with the key, return defult value if it is not
@@ -100,19 +101,19 @@ declare const inChrome: () => boolean;
100
101
  * @summary Given 2 objects and some keys, return items in the fresh object that do not exist in the
101
102
  * stale object by matching the given common key values of both objects.
102
103
  */
103
- declare const addedTo: (fresh: object[], stale: object[], keys: string[]) => object[];
104
+ declare const addedTo: (fresh: AnyObject[], stale: AnyObject[], keys: string[]) => AnyObject[];
104
105
  /**
105
106
  * @name removedFrom
106
107
  * @summary Given 2 objects and some keys, return items in the stale object that do not exist in the
107
108
  * fresh object by matching the given common key values of both objects.
108
109
  */
109
- declare const removedFrom: (fresh: object[], stale: object[], keys: string[]) => object[];
110
+ declare const removedFrom: (fresh: AnyObject[], stale: AnyObject[], keys: string[]) => AnyObject[];
110
111
  /**
111
112
  * @name matchedProperties
112
113
  * @summary Given 2 objects and some keys, return items in object 1 that also exist in object 2 by
113
114
  * matching the given common key values of both objects.
114
115
  */
115
- declare const matchedProperties: (objX: object[], objY: object[], keys: string[]) => object[];
116
+ declare const matchedProperties: (objX: AnyObject[], objY: AnyObject[], keys: string[]) => AnyObject[];
116
117
  /**
117
118
  * @name isValidHttpUrl
118
119
  * @summary Give a string, return whether it is a valid http URL.
@@ -124,7 +125,7 @@ declare const isValidHttpUrl: (string: string) => boolean;
124
125
  * @summary Makes a promise cancellable.
125
126
  * @param promise - The promise to make cancellable.
126
127
  */
127
- declare const makeCancelable: <T>(promise: Promise<T>) => {
128
+ declare const makeCancelable: (promise: Promise<AnyObject>) => {
128
129
  promise: Promise<unknown>;
129
130
  cancel: () => void;
130
131
  };
@@ -141,6 +142,6 @@ declare const unimplemented: ({ ...props }: {
141
142
  * @param target
142
143
  * @param ...sources
143
144
  */
144
- declare const mergeDeep: (target: object, ...sources: object[]) => any;
145
+ declare const mergeDeep: (target: AnyObject, ...sources: AnyObject[]) => AnyObject;
145
146
 
146
147
  export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash };
package/unit.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { RefObject } from 'react';
1
+ import { MutableRefObject, RefObject } from 'react';
2
+ import { AnyObject } from './types.js';
2
3
 
3
4
  /**
4
5
  * Converts an on-chain balance value from planck to a decimal value in token units.
@@ -43,7 +44,7 @@ declare const snakeToCamel: (str: string) => string;
43
44
  * @name setStateWithRef
44
45
  * @summary Synchronize React state and its reference with the provided value.
45
46
  */
46
- declare const setStateWithRef: <T>(value: T, setState: (_state: T) => void, ref: RefObject<T>) => void;
47
+ declare const setStateWithRef: <T>(value: T, setState: (_state: T) => void, ref: MutableRefObject<T>) => void;
47
48
  /**
48
49
  * @name localStorageOrDefault
49
50
  * @summary Retrieve the local stroage value with the key, return defult value if it is not
@@ -100,19 +101,19 @@ declare const inChrome: () => boolean;
100
101
  * @summary Given 2 objects and some keys, return items in the fresh object that do not exist in the
101
102
  * stale object by matching the given common key values of both objects.
102
103
  */
103
- declare const addedTo: (fresh: object[], stale: object[], keys: string[]) => object[];
104
+ declare const addedTo: (fresh: AnyObject[], stale: AnyObject[], keys: string[]) => AnyObject[];
104
105
  /**
105
106
  * @name removedFrom
106
107
  * @summary Given 2 objects and some keys, return items in the stale object that do not exist in the
107
108
  * fresh object by matching the given common key values of both objects.
108
109
  */
109
- declare const removedFrom: (fresh: object[], stale: object[], keys: string[]) => object[];
110
+ declare const removedFrom: (fresh: AnyObject[], stale: AnyObject[], keys: string[]) => AnyObject[];
110
111
  /**
111
112
  * @name matchedProperties
112
113
  * @summary Given 2 objects and some keys, return items in object 1 that also exist in object 2 by
113
114
  * matching the given common key values of both objects.
114
115
  */
115
- declare const matchedProperties: (objX: object[], objY: object[], keys: string[]) => object[];
116
+ declare const matchedProperties: (objX: AnyObject[], objY: AnyObject[], keys: string[]) => AnyObject[];
116
117
  /**
117
118
  * @name isValidHttpUrl
118
119
  * @summary Give a string, return whether it is a valid http URL.
@@ -124,7 +125,7 @@ declare const isValidHttpUrl: (string: string) => boolean;
124
125
  * @summary Makes a promise cancellable.
125
126
  * @param promise - The promise to make cancellable.
126
127
  */
127
- declare const makeCancelable: <T>(promise: Promise<T>) => {
128
+ declare const makeCancelable: (promise: Promise<AnyObject>) => {
128
129
  promise: Promise<unknown>;
129
130
  cancel: () => void;
130
131
  };
@@ -141,6 +142,6 @@ declare const unimplemented: ({ ...props }: {
141
142
  * @param target
142
143
  * @param ...sources
143
144
  */
144
- declare const mergeDeep: (target: object, ...sources: object[]) => any;
145
+ declare const mergeDeep: (target: AnyObject, ...sources: AnyObject[]) => AnyObject;
145
146
 
146
147
  export { addedTo, applyWidthAsPadding, capitalizeFirstLetter, extractUrlValue, inChrome, isValidAddress, isValidHttpUrl, localStorageOrDefault, makeCancelable, matchedProperties, mergeDeep, planckToUnit, remToUnit, removeVarFromUrlHash, removedFrom, setStateWithRef, snakeToCamel, sortWithNull, unescape, unimplemented, unitToPlanck, varToUrlHash };