xpine 0.0.29 → 0.0.30
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/dist/index.js
CHANGED
|
@@ -121,10 +121,12 @@ function createContext(value) {
|
|
|
121
121
|
},
|
|
122
122
|
runArrayQueue() {
|
|
123
123
|
Object.keys(arrayQueue).forEach((key) => {
|
|
124
|
-
arrayQueue[key].
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
const dates = arrayQueue[key].filter((item) => item?.position instanceof Date);
|
|
125
|
+
const numbers = arrayQueue[key].filter((item) => typeof item?.position === "number" || !item?.position);
|
|
126
|
+
const sortedDates = dates.toSorted((a, b) => b?.position.getTime() - a?.position.getTime());
|
|
127
|
+
const sortedNumbers = numbers.toSorted((a, b) => (a?.position ?? Infinity) - (b.position ?? Infinity));
|
|
128
|
+
const output = sortedNumbers.concat(sortedDates);
|
|
129
|
+
for (const item of output) {
|
|
128
130
|
this.set(key, item.value, []);
|
|
129
131
|
}
|
|
130
132
|
});
|
package/dist/src/context.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type State<StateProps> = {
|
|
|
4
4
|
set: (id: string, callback: SetContext<StateProps>, defaultValue?: any) => void;
|
|
5
5
|
clear: () => void;
|
|
6
6
|
getAll: () => any;
|
|
7
|
-
addToArray: (id: string, value: any, position?: number) => void;
|
|
7
|
+
addToArray: (id: string, value: any, position?: number | Date) => void;
|
|
8
8
|
getArrayQueue: () => any;
|
|
9
9
|
runArrayQueue: () => void;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE,IAAI,KAAK,IAAI,CAAC;AAE9D,MAAM,MAAM,KAAK,CAAC,UAAU,IAAI;IAC9B,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM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AM,OAAO,YAAoB,CAAC;AAEzC,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,kBACjC,GAAG,SAYnC"}
|
|
@@ -116,10 +116,12 @@ function createContext(value) {
|
|
|
116
116
|
},
|
|
117
117
|
runArrayQueue() {
|
|
118
118
|
Object.keys(arrayQueue).forEach((key) => {
|
|
119
|
-
arrayQueue[key].
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
const dates = arrayQueue[key].filter((item) => item?.position instanceof Date);
|
|
120
|
+
const numbers = arrayQueue[key].filter((item) => typeof item?.position === "number" || !item?.position);
|
|
121
|
+
const sortedDates = dates.toSorted((a, b) => b?.position.getTime() - a?.position.getTime());
|
|
122
|
+
const sortedNumbers = numbers.toSorted((a, b) => (a?.position ?? Infinity) - (b.position ?? Infinity));
|
|
123
|
+
const output = sortedNumbers.concat(sortedDates);
|
|
124
|
+
for (const item of output) {
|
|
123
125
|
this.set(key, item.value, []);
|
|
124
126
|
}
|
|
125
127
|
});
|
|
@@ -123,10 +123,12 @@ function createContext(value) {
|
|
|
123
123
|
},
|
|
124
124
|
runArrayQueue() {
|
|
125
125
|
Object.keys(arrayQueue).forEach((key) => {
|
|
126
|
-
arrayQueue[key].
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const dates = arrayQueue[key].filter((item) => item?.position instanceof Date);
|
|
127
|
+
const numbers = arrayQueue[key].filter((item) => typeof item?.position === "number" || !item?.position);
|
|
128
|
+
const sortedDates = dates.toSorted((a, b) => b?.position.getTime() - a?.position.getTime());
|
|
129
|
+
const sortedNumbers = numbers.toSorted((a, b) => (a?.position ?? Infinity) - (b.position ?? Infinity));
|
|
130
|
+
const output = sortedNumbers.concat(sortedDates);
|
|
131
|
+
for (const item of output) {
|
|
130
132
|
this.set(key, item.value, []);
|
|
131
133
|
}
|
|
132
134
|
});
|
package/package.json
CHANGED