@visulima/object 1.0.10 → 1.0.12
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/CHANGELOG.md +21 -0
- package/dist/index.d.cts +7 -2456
- package/dist/index.d.mts +7 -2456
- package/dist/index.d.ts +7 -2456
- package/dist/omit.d.cts +20 -0
- package/dist/omit.d.mts +20 -0
- package/dist/omit.d.ts +20 -0
- package/dist/pick.d.cts +20 -0
- package/dist/pick.d.mts +20 -0
- package/dist/pick.d.ts +20 -0
- package/dist/utils/paths-are-equal.d.cts +9 -0
- package/dist/utils/paths-are-equal.d.mts +9 -0
- package/dist/utils/paths-are-equal.d.ts +9 -0
- package/dist/utils/recursive-omit.d.cts +3 -0
- package/dist/utils/recursive-omit.d.mts +3 -0
- package/dist/utils/recursive-omit.d.ts +3 -0
- package/dist/utils/recursive-pick.d.cts +3 -0
- package/dist/utils/recursive-pick.d.mts +3 -0
- package/dist/utils/recursive-pick.d.ts +3 -0
- package/package.json +5 -5
package/dist/omit.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
import type { OmitDeep, Paths } from ".//index.d.d.cts";
|
|
9
|
+
/**
|
|
10
|
+
* omit returns a new object without the props you omit
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @template T
|
|
14
|
+
* @template K
|
|
15
|
+
* @param {T} object the target object to omit props from
|
|
16
|
+
* @param {K[]} keys the prop names you want to omit
|
|
17
|
+
* @returns {OmitDeep<T, K>} a new object without the omitted props
|
|
18
|
+
*/
|
|
19
|
+
declare const omit: <T extends { [key in string]: unknown; }, K extends string>(object: T, keys: Paths<T>[]) => OmitDeep<T, K>;
|
|
20
|
+
export = omit;
|
package/dist/omit.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
import type { OmitDeep, Paths } from ".//index.d.d.mts";
|
|
9
|
+
/**
|
|
10
|
+
* omit returns a new object without the props you omit
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @template T
|
|
14
|
+
* @template K
|
|
15
|
+
* @param {T} object the target object to omit props from
|
|
16
|
+
* @param {K[]} keys the prop names you want to omit
|
|
17
|
+
* @returns {OmitDeep<T, K>} a new object without the omitted props
|
|
18
|
+
*/
|
|
19
|
+
declare const omit: <T extends { [key in string]: unknown; }, K extends string>(object: T, keys: Paths<T>[]) => OmitDeep<T, K>;
|
|
20
|
+
export default omit;
|
package/dist/omit.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
import type { OmitDeep, Paths } from ".//index.d.d.ts";
|
|
9
|
+
/**
|
|
10
|
+
* omit returns a new object without the props you omit
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @template T
|
|
14
|
+
* @template K
|
|
15
|
+
* @param {T} object the target object to omit props from
|
|
16
|
+
* @param {K[]} keys the prop names you want to omit
|
|
17
|
+
* @returns {OmitDeep<T, K>} a new object without the omitted props
|
|
18
|
+
*/
|
|
19
|
+
declare const omit: <T extends { [key in string]: unknown; }, K extends string>(object: T, keys: Paths<T>[]) => OmitDeep<T, K>;
|
|
20
|
+
export = omit;
|
package/dist/pick.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
import type { Paths, PickDeep } from ".//index.d.d.cts";
|
|
9
|
+
/**
|
|
10
|
+
* pick returns a new object with only the props you pick
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @template T
|
|
14
|
+
* @template K
|
|
15
|
+
* @param {T} object the target object to pick props from
|
|
16
|
+
* @param {K[]} keys an array of prop names you want to keep - allows dot-notation for nested props, eg. `nested.prop` will keep just `{ nested: { prop: 1 } }`
|
|
17
|
+
* @returns {PickDeep<T, K>} a new object with just the picked props
|
|
18
|
+
*/
|
|
19
|
+
declare const pick: <T extends { [key in string]: unknown; }, K extends Paths<T>>(object: T, keys: Paths<T>[]) => PickDeep<T, K>;
|
|
20
|
+
export = pick;
|
package/dist/pick.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
import type { Paths, PickDeep } from ".//index.d.d.mts";
|
|
9
|
+
/**
|
|
10
|
+
* pick returns a new object with only the props you pick
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @template T
|
|
14
|
+
* @template K
|
|
15
|
+
* @param {T} object the target object to pick props from
|
|
16
|
+
* @param {K[]} keys an array of prop names you want to keep - allows dot-notation for nested props, eg. `nested.prop` will keep just `{ nested: { prop: 1 } }`
|
|
17
|
+
* @returns {PickDeep<T, K>} a new object with just the picked props
|
|
18
|
+
*/
|
|
19
|
+
declare const pick: <T extends { [key in string]: unknown; }, K extends Paths<T>>(object: T, keys: Paths<T>[]) => PickDeep<T, K>;
|
|
20
|
+
export default pick;
|
package/dist/pick.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
import type { Paths, PickDeep } from ".//index.d.d.ts";
|
|
9
|
+
/**
|
|
10
|
+
* pick returns a new object with only the props you pick
|
|
11
|
+
*
|
|
12
|
+
* @export
|
|
13
|
+
* @template T
|
|
14
|
+
* @template K
|
|
15
|
+
* @param {T} object the target object to pick props from
|
|
16
|
+
* @param {K[]} keys an array of prop names you want to keep - allows dot-notation for nested props, eg. `nested.prop` will keep just `{ nested: { prop: 1 } }`
|
|
17
|
+
* @returns {PickDeep<T, K>} a new object with just the picked props
|
|
18
|
+
*/
|
|
19
|
+
declare const pick: <T extends { [key in string]: unknown; }, K extends Paths<T>>(object: T, keys: Paths<T>[]) => PickDeep<T, K>;
|
|
20
|
+
export = pick;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/pathsAreEqual.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
declare const pathsAreEqual: (path: string, wildcardPath: string) => boolean;
|
|
9
|
+
export = pathsAreEqual;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/pathsAreEqual.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
declare const pathsAreEqual: (path: string, wildcardPath: string) => boolean;
|
|
9
|
+
export default pathsAreEqual;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/mesqueeb/filter-anything/blob/main/src/pathsAreEqual.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 Luca Ban - Mesqueeb
|
|
7
|
+
*/
|
|
8
|
+
declare const pathsAreEqual: (path: string, wildcardPath: string) => boolean;
|
|
9
|
+
export = pathsAreEqual;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/object",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Helper functions for working with objects and arrays.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"type": "module",
|
|
50
50
|
"exports": {
|
|
51
51
|
".": {
|
|
52
|
-
"require": {
|
|
53
|
-
"types": "./dist/index.d.cts",
|
|
54
|
-
"default": "./dist/index.cjs"
|
|
55
|
-
},
|
|
56
52
|
"import": {
|
|
57
53
|
"types": "./dist/index.d.mts",
|
|
58
54
|
"default": "./dist/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/index.d.cts",
|
|
58
|
+
"default": "./dist/index.cjs"
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"./package.json": "./package.json"
|