@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 +1 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/unit.d.cts +8 -7
- package/unit.d.ts +8 -7
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
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 };
|