shelving 1.61.1 → 1.62.0
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/package.json +7 -7
- package/util/iterate.js +2 -2
- package/util/object.js +1 -1
- package/util/observable.js +2 -2
- package/util/units.d.ts +5 -0
- package/util/units.js +6 -1
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"state-management",
|
|
12
12
|
"query-builder"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.62.0",
|
|
15
15
|
"repository": "https://github.com/dhoulb/shelving",
|
|
16
16
|
"author": "Dave Houlbrooke <dave@shax.com>",
|
|
17
17
|
"license": "0BSD",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@google-cloud/firestore": "^5.0.2",
|
|
63
63
|
"@types/jest": "^27.5.1",
|
|
64
|
-
"@types/react": "^
|
|
65
|
-
"@types/react-dom": "^
|
|
64
|
+
"@types/react": "^18.0.9",
|
|
65
|
+
"@types/react-dom": "^18.0.4",
|
|
66
66
|
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
|
67
67
|
"@typescript-eslint/parser": "^5.23.0",
|
|
68
68
|
"eslint": "^8.15.0",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"eslint-plugin-import": "^2.26.0",
|
|
71
71
|
"eslint-plugin-prettier": "^4.0.0",
|
|
72
72
|
"firebase": "^9.8.1",
|
|
73
|
-
"jest": "^
|
|
73
|
+
"jest": "^28.1.0",
|
|
74
74
|
"jest-ts-webcompat-resolver": "^1.0.0",
|
|
75
75
|
"prettier": "^2.6.2",
|
|
76
|
-
"react": "^
|
|
77
|
-
"react-dom": "^
|
|
78
|
-
"ts-jest": "^
|
|
76
|
+
"react": "^18.1.0",
|
|
77
|
+
"react-dom": "^18.1.0",
|
|
78
|
+
"ts-jest": "^28.0.2",
|
|
79
79
|
"typescript": "^4.6.4"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
package/util/iterate.js
CHANGED
|
@@ -29,7 +29,7 @@ export function countItems(items) {
|
|
|
29
29
|
export function countIterations(items) {
|
|
30
30
|
let count = 0;
|
|
31
31
|
for (const unused of items)
|
|
32
|
-
count++;
|
|
32
|
+
count++;
|
|
33
33
|
return count;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -46,7 +46,7 @@ export function hasItems(items) {
|
|
|
46
46
|
*/
|
|
47
47
|
export function hasIterations(items) {
|
|
48
48
|
for (const unused of items)
|
|
49
|
-
return true;
|
|
49
|
+
return true;
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
52
|
/**
|
package/util/object.js
CHANGED
|
@@ -38,7 +38,7 @@ export const withEntries = withProps;
|
|
|
38
38
|
*/
|
|
39
39
|
export function withoutEntry(input, key, value) {
|
|
40
40
|
if (isKey(input, key) && (value === undefined || input[key] === value)) {
|
|
41
|
-
const { [key]: unused, ...output } = input;
|
|
41
|
+
const { [key]: unused, ...output } = input;
|
|
42
42
|
return output;
|
|
43
43
|
}
|
|
44
44
|
return input;
|
package/util/observable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConditionError } from "../error/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { dispatch } from "./function.js";
|
|
3
3
|
import { logError } from "./error.js";
|
|
4
4
|
import { isData } from "./data.js";
|
|
5
5
|
import { transform } from "./transform.js";
|
|
@@ -164,5 +164,5 @@ export function awaitNext(source) {
|
|
|
164
164
|
}
|
|
165
165
|
/** Get a promise that resolves when a source subscribable is complete. */
|
|
166
166
|
export function awaitComplete(source) {
|
|
167
|
-
return new Promise((complete, error) => new ThroughObserver({
|
|
167
|
+
return new Promise((complete, error) => new ThroughObserver({ complete, error }).from(source));
|
|
168
168
|
}
|
package/util/units.d.ts
CHANGED
|
@@ -53,3 +53,8 @@ export declare const formatUnits: (num: number, unit: UnitReference, maxPrecisio
|
|
|
53
53
|
* @param maxPrecision Number of decimal places to round the number to e.g. `2`
|
|
54
54
|
*/
|
|
55
55
|
export declare const formatFullUnits: (num: number, unit: UnitReference, maxPrecision?: number | undefined, minPrecision?: number | undefined) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Format a percentage.
|
|
58
|
+
* - Combines `getPercent()` and `formatUnits()` for convenience.
|
|
59
|
+
*/
|
|
60
|
+
export declare const formatPercent: (numerator: number, denumerator: number, maxPrecision?: number | undefined, minPrecision?: number | undefined) => string;
|
package/util/units.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssertionError } from "../error/index.js";
|
|
2
|
-
import { formatFullQuantity, formatQuantity, MILLION } from "./number.js";
|
|
2
|
+
import { formatFullQuantity, formatQuantity, getPercent, MILLION } from "./number.js";
|
|
3
3
|
import { NNBSP } from "./string.js";
|
|
4
4
|
/** One second in millseconds. */
|
|
5
5
|
export const SECOND = 1000;
|
|
@@ -80,3 +80,8 @@ export const formatUnits = (num, unit, maxPrecision, minPrecision) => formatQuan
|
|
|
80
80
|
* @param maxPrecision Number of decimal places to round the number to e.g. `2`
|
|
81
81
|
*/
|
|
82
82
|
export const formatFullUnits = (num, unit, maxPrecision, minPrecision) => formatFullQuantity(num, UNITS[unit].singular || unit, UNITS[unit].plural || `${unit}s`, maxPrecision, minPrecision);
|
|
83
|
+
/**
|
|
84
|
+
* Format a percentage.
|
|
85
|
+
* - Combines `getPercent()` and `formatUnits()` for convenience.
|
|
86
|
+
*/
|
|
87
|
+
export const formatPercent = (numerator, denumerator, maxPrecision, minPrecision) => formatQuantity(getPercent(numerator, denumerator), UNITS.percent.suffix, maxPrecision, minPrecision);
|