@valkyriestudios/utils 12.38.0 → 12.40.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/cjs/date/format.js +3 -7
- package/cjs/date/isFormat.js +17 -12
- package/cjs/deep/get.js +6 -4
- package/cjs/formdata/toObject.js +21 -14
- package/cjs/modules/Scheduler.js +8 -8
- package/cjs/object/merge.js +11 -13
- package/cjs/object/omit.js +15 -15
- package/date/isFormat.d.ts +2 -0
- package/esm/date/format.js +3 -7
- package/esm/date/isFormat.js +16 -12
- package/esm/deep/get.js +6 -4
- package/esm/formdata/toObject.js +21 -14
- package/esm/modules/Scheduler.js +8 -8
- package/esm/object/merge.js +11 -13
- package/esm/object/omit.js +15 -15
- package/index.d.ts +6 -4
- package/package.json +197 -197
package/esm/object/omit.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
function innerOmit(obj, keys) {
|
|
2
2
|
const result = { ...obj };
|
|
3
|
-
const groups = {};
|
|
4
3
|
for (let i = 0; i < keys.length; i++) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const key = keys[i];
|
|
5
|
+
if (typeof key !== 'string')
|
|
6
|
+
continue;
|
|
7
|
+
let target = result;
|
|
8
|
+
const parts = key.split('.');
|
|
9
|
+
const last = parts.length - 1;
|
|
10
|
+
for (let j = 0; j < last; j++) {
|
|
11
|
+
const part = parts[j];
|
|
12
|
+
const val = target[part];
|
|
13
|
+
if (Object.prototype.toString.call(val) === '[object Object]') {
|
|
14
|
+
if (target[part] === obj[part]) {
|
|
15
|
+
target[part] = { ...val };
|
|
16
|
+
}
|
|
17
|
+
target = target[part];
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
for (const root in groups) {
|
|
18
|
-
if (typeof result[root] === 'object' &&
|
|
19
|
-
result[root] !== null)
|
|
20
|
-
result[root] = innerOmit(result[root], groups[root]);
|
|
20
|
+
delete target[parts[last]];
|
|
21
21
|
}
|
|
22
22
|
return result;
|
|
23
23
|
}
|
package/index.d.ts
CHANGED
|
@@ -205,6 +205,12 @@ declare module "caching/LRU" {
|
|
|
205
205
|
}
|
|
206
206
|
export { LRUCache, LRUCache as default };
|
|
207
207
|
}
|
|
208
|
+
declare module "date/isFormat" {
|
|
209
|
+
export const MONTHS_LEAP: number[];
|
|
210
|
+
export const MONTHS: number[];
|
|
211
|
+
function isDateFormat(input: unknown, spec: string): input is string;
|
|
212
|
+
export { isDateFormat, isDateFormat as default };
|
|
213
|
+
}
|
|
208
214
|
declare module "date/format" {
|
|
209
215
|
const WEEK_STARTS: {
|
|
210
216
|
readonly mon: "mon";
|
|
@@ -262,10 +268,6 @@ declare module "date/toUTC" {
|
|
|
262
268
|
function toUTC(val: Date): Date;
|
|
263
269
|
export { toUTC, toUTC as default };
|
|
264
270
|
}
|
|
265
|
-
declare module "date/isFormat" {
|
|
266
|
-
function isDateFormat(input: unknown, spec: string): input is string;
|
|
267
|
-
export { isDateFormat, isDateFormat as default };
|
|
268
|
-
}
|
|
269
271
|
declare module "date/index" {
|
|
270
272
|
export { addUTC } from "date/addUTC";
|
|
271
273
|
export { convertToDate } from "date/convertToDate";
|