@visulima/object 3.0.0-alpha.12 → 3.0.0-alpha.14
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 +28 -0
- package/LICENSE.md +1 -40
- package/dist/index.d.ts +181 -7
- package/dist/index.js +1 -1
- package/dist/packem_shared/{isPlainObject-CLTs8VdF.js → isPlainObject-CKRRjQp3.js} +1 -1
- package/dist/packem_shared/omit-CFZMq4XQ.js +1 -0
- package/dist/packem_shared/{pick-DxtQt02k.js → pick-gi5xtds4.js} +1 -1
- package/package.json +5 -10
- package/dist/omit.d.ts +0 -18
- package/dist/packem_shared/omit-B99pE0nL.js +0 -1
- package/dist/pick.d.ts +0 -18
- package/dist/utils/paths-are-equal.d.ts +0 -15
- package/dist/utils/recursive-omit.d.ts +0 -3
- package/dist/utils/recursive-pick.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## @visulima/object [3.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/object@3.0.0-alpha.13...@visulima/object@3.0.0-alpha.14) (2026-05-27)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **storage-client:** percent-encode user fields in defaultFingerprint ([7c78a0f](https://github.com/visulima/visulima/commit/7c78a0f9512e2a673b941d80839e9f1e86b7b5d0))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* **ci-stability:** green CI across vis, native, lint, tests, attw ([#651](https://github.com/visulima/visulima/issues/651)) ([d4eb684](https://github.com/visulima/visulima/commit/d4eb684b5f75c818c9251048c605a0ed54a268e3))
|
|
10
|
+
* **object:** apply formatter sweep and clean license attribution ([697adb2](https://github.com/visulima/visulima/commit/697adb268bb007cf4f6983f4a89a1258a9ff208d))
|
|
11
|
+
* **object:** apply prettier and eslint quote-style auto-fix ([fb4c54f](https://github.com/visulima/visulima/commit/fb4c54f719e6ca1d03ac56c7f9f9067f9731f17e))
|
|
12
|
+
* **object:** fix lint errors ([386c5f0](https://github.com/visulima/visulima/commit/386c5f0f6e36d0491e674c03196710a40f1e91c0))
|
|
13
|
+
* **object:** housekeeping cleanup ([99d38b2](https://github.com/visulima/visulima/commit/99d38b214e62548810b2b362bd8b9483e242fdcc))
|
|
14
|
+
* **object:** upgrade packem to 2.0.0-alpha.76 ([729158f](https://github.com/visulima/visulima/commit/729158f5a0d8a445227c7df7170f3bd7654e0546))
|
|
15
|
+
* re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
|
|
16
|
+
* **repo:** sort package.json keys across all packages ([e1fd9ab](https://github.com/visulima/visulima/commit/e1fd9ab467ef96a98c777da1572ff6a50fcf7e71))
|
|
17
|
+
* sorted package.json ([b47c545](https://github.com/visulima/visulima/commit/b47c545591600fdab17d5cd3a3fbc68b61e199da))
|
|
18
|
+
|
|
19
|
+
### Tests
|
|
20
|
+
|
|
21
|
+
* **repo:** add dist runtime + types integration tests ([32ee300](https://github.com/visulima/visulima/commit/32ee300b7184117a0ddf9f9d390f75f8932d5ed9))
|
|
22
|
+
|
|
23
|
+
## @visulima/object [3.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/object@3.0.0-alpha.12...@visulima/object@3.0.0-alpha.13) (2026-04-22)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* Remove JSR configuration generation script and generated jsr.json files ([#616](https://github.com/visulima/visulima/issues/616)) ([533744b](https://github.com/visulima/visulima/commit/533744b103b74896941db5b727173e617a27a63b))
|
|
28
|
+
|
|
1
29
|
## @visulima/object [3.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/object@3.0.0-alpha.11...@visulima/object@3.0.0-alpha.12) (2026-04-21)
|
|
2
30
|
|
|
3
31
|
### Miscellaneous Chores
|
package/LICENSE.md
CHANGED
|
@@ -49,44 +49,23 @@ Repository: sindresorhus/dot-prop
|
|
|
49
49
|
>
|
|
50
50
|
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
51
51
|
|
|
52
|
-
---------------------------------------
|
|
53
|
-
|
|
54
|
-
## is-plain-obj
|
|
55
|
-
License: MIT
|
|
56
|
-
By: Sindre Sorhus
|
|
57
|
-
Repository: sindresorhus/is-plain-obj
|
|
58
|
-
|
|
59
|
-
> MIT License
|
|
60
|
-
>
|
|
61
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
62
|
-
>
|
|
63
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
64
|
-
>
|
|
65
|
-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
66
|
-
>
|
|
67
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
68
|
-
|
|
69
52
|
<!-- /DEPENDENCIES -->
|
|
70
53
|
|
|
71
54
|
<!-- TYPE_DEPENDENCIES -->
|
|
72
55
|
|
|
73
56
|
# Licenses of bundled types
|
|
74
|
-
|
|
75
57
|
The published @visulima/object artifact additionally contains code with the following licenses:
|
|
76
58
|
MIT
|
|
77
59
|
|
|
78
60
|
# Bundled types:
|
|
79
|
-
|
|
80
61
|
## deeks
|
|
81
|
-
|
|
82
62
|
License: MIT
|
|
83
63
|
By: mrodrig
|
|
84
64
|
Repository: git+https://github.com/mrodrig/deeks.git
|
|
85
65
|
|
|
86
|
-
|
|
66
|
+
---------------------------------------
|
|
87
67
|
|
|
88
68
|
## dot-prop
|
|
89
|
-
|
|
90
69
|
License: MIT
|
|
91
70
|
By: Sindre Sorhus
|
|
92
71
|
Repository: sindresorhus/dot-prop
|
|
@@ -101,22 +80,4 @@ Repository: sindresorhus/dot-prop
|
|
|
101
80
|
>
|
|
102
81
|
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
103
82
|
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## is-plain-obj
|
|
107
|
-
|
|
108
|
-
License: MIT
|
|
109
|
-
By: Sindre Sorhus
|
|
110
|
-
Repository: sindresorhus/is-plain-obj
|
|
111
|
-
|
|
112
|
-
> MIT License
|
|
113
|
-
>
|
|
114
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
115
|
-
>
|
|
116
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
117
|
-
>
|
|
118
|
-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
119
|
-
>
|
|
120
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
121
|
-
|
|
122
83
|
<!-- /TYPE_DEPENDENCIES -->
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,181 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Paths, OmitDeep, PickDeep, Get } from 'type-fest';
|
|
2
|
+
export { type OmitDeep, type Paths, type PickDeep, type Split } from 'type-fest';
|
|
3
|
+
/**
|
|
4
|
+
* Omit returns a new object without the props you omit.
|
|
5
|
+
* @template T
|
|
6
|
+
* @template K
|
|
7
|
+
* @param object the target object to omit props from
|
|
8
|
+
* @param keys the prop names you want to omit
|
|
9
|
+
* @returns a new object without the omitted props
|
|
10
|
+
*/
|
|
11
|
+
declare const omit: <T extends { [key in string]: unknown }, K extends string>(object: T, keys: Paths<T>[]) => OmitDeep<T, K>;
|
|
12
|
+
/**
|
|
13
|
+
* Pick returns a new object with only the props you pick.
|
|
14
|
+
* @template T
|
|
15
|
+
* @template K
|
|
16
|
+
* @param object the target object to pick props from
|
|
17
|
+
* @param 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 } }`
|
|
18
|
+
* @returns a new object with just the picked props
|
|
19
|
+
*/
|
|
20
|
+
declare const pick: <T extends { [key in string]: unknown }, K extends Paths<T>>(object: T, keys: Paths<T>[]) => PickDeep<T, K>;
|
|
21
|
+
/**
|
|
22
|
+
* Determines whether a value is a plain object (i.e. created from `{}` or `Object.create(null)`).
|
|
23
|
+
* @param value Value to inspect.
|
|
24
|
+
* @returns `true` if the value is a plain object, otherwise `false`.
|
|
25
|
+
*/
|
|
26
|
+
declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
27
|
+
interface DeeksOptions {
|
|
28
|
+
/** @default false */
|
|
29
|
+
arrayIndexesAsKeys?: boolean;
|
|
30
|
+
/** @default true */
|
|
31
|
+
expandNestedObjects?: boolean;
|
|
32
|
+
/** @default false */
|
|
33
|
+
expandArrayObjects?: boolean;
|
|
34
|
+
/** @default false */
|
|
35
|
+
ignoreEmptyArraysWhenExpanding?: boolean;
|
|
36
|
+
/** @default false */
|
|
37
|
+
escapeNestedDots?: boolean;
|
|
38
|
+
/** @default false */
|
|
39
|
+
ignoreEmptyArrays?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Return the deep keys list for a single document
|
|
43
|
+
* @param object
|
|
44
|
+
* @param options
|
|
45
|
+
* @returns {Array}
|
|
46
|
+
*/
|
|
47
|
+
declare function deepKeys(object: object, options?: DeeksOptions): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Return the deep keys list for all documents in the provided list
|
|
50
|
+
* @param list
|
|
51
|
+
* @param options
|
|
52
|
+
* @returns Array[Array[String]]
|
|
53
|
+
*/
|
|
54
|
+
declare function deepKeysFromList(list: object[], options?: DeeksOptions, visited?: WeakSet<object>): string[][];
|
|
55
|
+
/**
|
|
56
|
+
Get the value of the property at the given path.
|
|
57
|
+
|
|
58
|
+
@param object - Object or array to get the `path` value.
|
|
59
|
+
@param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. Array indices can be accessed using bracket notation (`'users[0].name'`) or dot notation (`'users.0.name'`). Both syntaxes are equivalent and will create arrays when setting values. Numeric strings in dot notation (like `'users.0.name'`) are automatically coerced to numbers. When using array paths, numeric strings are normalized to numbers for simplicity (treating `['users', '0']` the same as `['users', 0]`).
|
|
60
|
+
@param defaultValue - Default value.
|
|
61
|
+
|
|
62
|
+
@example
|
|
63
|
+
```
|
|
64
|
+
import {getProperty} from 'dot-prop';
|
|
65
|
+
|
|
66
|
+
getProperty({foo: {bar: 'unicorn'}}, 'foo.bar');
|
|
67
|
+
//=> 'unicorn'
|
|
68
|
+
|
|
69
|
+
getProperty({foo: {bar: 'a'}}, 'foo.notDefined.deep');
|
|
70
|
+
//=> undefined
|
|
71
|
+
|
|
72
|
+
getProperty({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value');
|
|
73
|
+
//=> 'default value'
|
|
74
|
+
|
|
75
|
+
getProperty({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot');
|
|
76
|
+
//=> 'unicorn'
|
|
77
|
+
|
|
78
|
+
getProperty({foo: [{bar: 'unicorn'}]}, 'foo[0].bar');
|
|
79
|
+
//=> 'unicorn'
|
|
80
|
+
|
|
81
|
+
getProperty({foo: [{bar: 'unicorn'}]}, 'foo.0.bar');
|
|
82
|
+
//=> 'unicorn'
|
|
83
|
+
```
|
|
84
|
+
*/
|
|
85
|
+
declare function getProperty<ObjectType, PathType extends string, DefaultValue = undefined>(object: ObjectType, path: PathType | ReadonlyArray<string | number>, defaultValue?: DefaultValue): ObjectType extends Record<string, unknown> | unknown[] ? (unknown extends Get<ObjectType, PathType> ? DefaultValue : Get<ObjectType, PathType>) : DefaultValue extends undefined ? unknown : DefaultValue;
|
|
86
|
+
/**
|
|
87
|
+
Set the property at the given path to the given value.
|
|
88
|
+
|
|
89
|
+
@param object - Object or array to set the `path` value.
|
|
90
|
+
@param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. Array indices can be accessed using bracket notation (`'users[0].name'`) or dot notation (`'users.0.name'`). Both syntaxes are equivalent and will create arrays when setting values. Numeric strings in dot notation (like `'users.0.name'`) are automatically coerced to numbers. When using array paths, numeric strings are normalized to numbers for simplicity (treating `['users', '0']` the same as `['users', 0]`).
|
|
91
|
+
@param value - Value to set at `path`.
|
|
92
|
+
@returns The object.
|
|
93
|
+
|
|
94
|
+
@example
|
|
95
|
+
```
|
|
96
|
+
import {setProperty} from 'dot-prop';
|
|
97
|
+
|
|
98
|
+
const object = {foo: {bar: 'a'}};
|
|
99
|
+
setProperty(object, 'foo.bar', 'b');
|
|
100
|
+
console.log(object);
|
|
101
|
+
//=> {foo: {bar: 'b'}}
|
|
102
|
+
|
|
103
|
+
const foo = setProperty({}, 'foo.bar', 'c');
|
|
104
|
+
console.log(foo);
|
|
105
|
+
//=> {foo: {bar: 'c'}}
|
|
106
|
+
|
|
107
|
+
setProperty(object, 'foo.baz', 'x');
|
|
108
|
+
console.log(object);
|
|
109
|
+
//=> {foo: {bar: 'b', baz: 'x'}}
|
|
110
|
+
|
|
111
|
+
setProperty(object, 'foo.biz[0]', 'a');
|
|
112
|
+
console.log(object);
|
|
113
|
+
//=> {foo: {bar: 'b', baz: 'x', biz: ['a']}}
|
|
114
|
+
|
|
115
|
+
setProperty(object, 'foo.items.0', 'first');
|
|
116
|
+
console.log(object);
|
|
117
|
+
//=> {foo: {bar: 'b', baz: 'x', biz: ['a'], items: ['first']}}
|
|
118
|
+
```
|
|
119
|
+
*/
|
|
120
|
+
declare function setProperty<ObjectType extends (Record<string, any> | unknown[])>(object: ObjectType, path: string | ReadonlyArray<string | number>, value: unknown): ObjectType;
|
|
121
|
+
/**
|
|
122
|
+
Check whether the property at the given path exists.
|
|
123
|
+
|
|
124
|
+
@param object - Object or array to test the `path` value.
|
|
125
|
+
@param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. Array indices can be accessed using bracket notation (`'users[0].name'`) or dot notation (`'users.0.name'`). Both syntaxes are equivalent and will create arrays when setting values. Numeric strings in dot notation (like `'users.0.name'`) are automatically coerced to numbers. When using array paths, numeric strings are normalized to numbers for simplicity (treating `['users', '0']` the same as `['users', 0]`).
|
|
126
|
+
|
|
127
|
+
@example
|
|
128
|
+
```
|
|
129
|
+
import {hasProperty} from 'dot-prop';
|
|
130
|
+
|
|
131
|
+
hasProperty({foo: {bar: 'unicorn'}}, 'foo.bar');
|
|
132
|
+
//=> true
|
|
133
|
+
```
|
|
134
|
+
*/
|
|
135
|
+
declare function hasProperty(object: Record<string, any> | unknown[] | undefined, path: string | ReadonlyArray<string | number>): boolean;
|
|
136
|
+
/**
|
|
137
|
+
Delete the property at the given path.
|
|
138
|
+
|
|
139
|
+
@param object - Object or array to delete the `path` value.
|
|
140
|
+
@param path - Path of the property in the object, using `.` to separate each nested key. Use `\\.` if you have a `.` in the key. Array indices can be accessed using bracket notation (`'users[0].name'`) or dot notation (`'users.0.name'`). Both syntaxes are equivalent and will create arrays when setting values. Numeric strings in dot notation (like `'users.0.name'`) are automatically coerced to numbers. When using array paths, numeric strings are normalized to numbers for simplicity (treating `['users', '0']` the same as `['users', 0]`).
|
|
141
|
+
@returns A boolean of whether the property existed before being deleted.
|
|
142
|
+
|
|
143
|
+
@example
|
|
144
|
+
```
|
|
145
|
+
import {deleteProperty} from 'dot-prop';
|
|
146
|
+
|
|
147
|
+
const object = {foo: {bar: 'a'}};
|
|
148
|
+
deleteProperty(object, 'foo.bar');
|
|
149
|
+
console.log(object);
|
|
150
|
+
//=> {foo: {}}
|
|
151
|
+
|
|
152
|
+
object.foo.bar = {x: 'y', y: 'x'};
|
|
153
|
+
deleteProperty(object, 'foo.bar.x');
|
|
154
|
+
console.log(object);
|
|
155
|
+
//=> {foo: {bar: {y: 'x'}}}
|
|
156
|
+
```
|
|
157
|
+
*/
|
|
158
|
+
declare function deleteProperty(object: Record<string, any> | unknown[], path: string | ReadonlyArray<string | number>): boolean;
|
|
159
|
+
/**
|
|
160
|
+
Escape special characters in a path. Useful for sanitizing user input.
|
|
161
|
+
|
|
162
|
+
@param path - The dot path to sanitize.
|
|
163
|
+
|
|
164
|
+
@example
|
|
165
|
+
```
|
|
166
|
+
import {getProperty, escapePath} from 'dot-prop';
|
|
167
|
+
|
|
168
|
+
const object = {
|
|
169
|
+
foo: {
|
|
170
|
+
bar: '👸🏻 You found me Mario!',
|
|
171
|
+
},
|
|
172
|
+
'foo.bar' : '🍄 The princess is in another castle!',
|
|
173
|
+
};
|
|
174
|
+
const escapedPath = escapePath('foo.bar');
|
|
175
|
+
|
|
176
|
+
console.log(getProperty(object, escapedPath));
|
|
177
|
+
//=> '🍄 The princess is in another castle!'
|
|
178
|
+
```
|
|
179
|
+
*/
|
|
180
|
+
declare function escapePath(path: string): string;
|
|
181
|
+
export { type DeeksOptions as DeepKeysOptions, deepKeys, deepKeysFromList, deleteProperty, escapePath, getProperty, hasProperty, isPlainObject, omit, pick, setProperty };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var a=(t,c)=>T(t,"name",{value:c,configurable:!0});import{default as $}from"./packem_shared/omit-
|
|
1
|
+
var T=Object.defineProperty;var a=(t,c)=>T(t,"name",{value:c,configurable:!0});import{default as $}from"./packem_shared/omit-CFZMq4XQ.js";import{default as te}from"./packem_shared/pick-gi5xtds4.js";import{default as ne}from"./packem_shared/isPlainObject-CKRRjQp3.js";import{deleteProperty as oe,escapePath as se,getProperty as ue,hasProperty as ce,setProperty as ie}from"./packem_shared/getProperty-DPNB_aKG.js";var W=Object.defineProperty,j=a((t,c)=>W(t,"name",{value:c,configurable:!0}),"t");function B(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}a(B,"getDefaultExportFromCjs");j(B,"getDefaultExportFromCjs");function C(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}a(C,"getDefaultExportFromNamespaceIfPresent");j(C,"getDefaultExportFromNamespaceIfPresent");function U(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}a(U,"getDefaultExportFromNamespaceIfNotNamed");j(U,"getDefaultExportFromNamespaceIfNotNamed");function z(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var c=t.default;if(typeof c=="function"){var u=j(a(function p(){var y=!1;try{y=this instanceof p}catch{}return y?Reflect.construct(c,arguments,this.constructor):c.apply(this,arguments)},"a"),"a");u.prototype=c.prototype}else u={};return Object.defineProperty(u,"__esModule",{value:!0}),Object.keys(t).forEach(function(p){var y=Object.getOwnPropertyDescriptor(t,p);Object.defineProperty(u,p,y.get?y:{enumerable:!0,get:j(function(){return t[p]},"get")})}),u}a(z,"getAugmentedNamespace");j(z,"getAugmentedNamespace");var l={},b={},S;function G(){if(S)return b;S=1;var t=Object.defineProperty,c=a((f,D)=>t(f,"name",{value:D,configurable:!0}),"t");Object.defineProperty(b,"__esModule",{value:!0}),b.isDocumentToRecurOn=b.flatten=b.unique=void 0;function u(f){return[...new Set(f)]}a(u,"unique"),c(u,"unique"),b.unique=u;function p(f){return[].concat(...f)}a(p,"flatten"),c(p,"flatten"),b.flatten=p;function y(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).length}return a(y,"isDocumentToRecurOn"),c(y,"isDocumentToRecurOn"),b.isDocumentToRecurOn=y,b}a(G,"requireUtils");var E={},I;function H(){return I||(I=1,Object.defineProperty(E,"__esModule",{value:!0})),E}a(H,"requireTypes");var R;function J(){return R||(R=1,(function(t){var c=Object.defineProperty,u=a((e,r)=>c(e,"name",{value:r,configurable:!0}),"u"),p=l&&l.__createBinding||(Object.create?(function(e,r,n,o){o===void 0&&(o=n);var s=Object.getOwnPropertyDescriptor(r,n);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:u(function(){return r[n]},"get")}),Object.defineProperty(e,o,s)}):(function(e,r,n,o){o===void 0&&(o=n),e[o]=r[n]})),y=l&&l.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),f=l&&l.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&p(r,e,n);return y(r,e),r},D=l&&l.__exportStar||function(e,r){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(r,n)&&p(r,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.deepKeysFromList=t.deepKeys=void 0;const v=f(G());D(H(),t);function q(e,r){const n=N(r);return typeof e=="object"&&e!==null?k("",e,n,new WeakSet):[]}a(q,"deepKeys"),u(q,"deepKeys"),t.deepKeys=q;function K(e,r,n){const o=N(r),s=n??new WeakSet;return e.map(d=>typeof d=="object"&&d!==null?s.has(d)?[]:k("",d,o,s):[])}a(K,"deepKeysFromList"),u(K,"deepKeysFromList"),t.deepKeysFromList=K;function k(e,r,n,o){const s=[],d=Object.keys(r);o.add(r);const m=[{obj:r,keys:d,i:0,basePath:e}];for(;m.length;){const O=m[m.length-1];if(O.i>=O.keys.length){m.pop();continue}const F=O.keys[O.i++],i=O.obj[F],P=_(O.basePath,x(F,n));if(n.expandNestedObjects&&v.isDocumentToRecurOn(i)||n.arrayIndexesAsKeys&&Array.isArray(i)&&i.length)if(n.arrayIndexesAsKeys&&Array.isArray(i)){const A=i;for(let h=A.length-1;h>=0;h--){const g=A[h],M=_(P,String(h));typeof g=="object"&&g!==null&&!Array.isArray(g)?o.has(g)||(o.add(g),m.push({obj:g,keys:Object.keys(g),i:0,basePath:M})):s.push(M)}}else o.has(i)||(o.add(i),m.push({obj:i,keys:Object.keys(i),i:0,basePath:P}));else if(n.expandArrayObjects&&Array.isArray(i)){const A=w(i,P,n,o);for(const h of A)s.push(h)}else{if(n.ignoreEmptyArrays&&Array.isArray(i)&&!i.length)continue;s.push(P)}}return v.unique(s)}a(k,"generateDeepKeysList"),u(k,"generateDeepKeysList");function w(e,r,n,o){let s=K(e,n,o);return e.length?e.length&&v.flatten(s).length===0?[r]:(s=s.map(d=>Array.isArray(d)&&d.length===0?[r]:d.map(m=>_(r,x(m,n)))),v.unique(v.flatten(s))):n.ignoreEmptyArraysWhenExpanding?[]:[r]}a(w,"processArrayKeys"),u(w,"processArrayKeys");function x(e,r){return r.escapeNestedDots?e.replace(/\./g,"\\."):e}a(x,"escapeNestedDotsIfSpecified"),u(x,"escapeNestedDotsIfSpecified");function _(e,r){return e?e+"."+r:r}a(_,"buildKeyName"),u(_,"buildKeyName");function N(e){return{arrayIndexesAsKeys:!1,expandNestedObjects:!0,expandArrayObjects:!1,ignoreEmptyArraysWhenExpanding:!1,escapeNestedDots:!1,ignoreEmptyArrays:!1,...e??{}}}a(N,"mergeOptions"),u(N,"mergeOptions")})(l)),l}a(J,"requireDeeks");var L=J();const V=L.deepKeys,X=L.deepKeysFromList;export{V as deepKeys,X as deepKeysFromList,oe as deleteProperty,se as escapePath,ue as getProperty,ce as hasProperty,ne as isPlainObject,$ as omit,te as pick,ie as setProperty};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var r=Object.defineProperty;var o=(e,t)=>r(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,l=o((e,t)=>n(e,"name",{value:t,configurable:!0}),"
|
|
1
|
+
var r=Object.defineProperty;var o=(e,t)=>r(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,l=o((e,t)=>n(e,"name",{value:t,configurable:!0}),"n");const b=l(e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},"isPlainObject");export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var i=(r,e)=>f(r,"name",{value:e,configurable:!0});import u from"./isPlainObject-CKRRjQp3.js";import{c as v}from"./paths-are-equal-BYur8Hqc.js";var b=Object.defineProperty,p=i((r,e)=>b(r,"name",{value:e,configurable:!0}),"u");const m=p((r,e,l="")=>u(r)?Object.entries(r).reduce((a,[o,n])=>{let t=l;return t&&(t+="."),t+=o,e.some(s=>v(t,s))?a:u(n)?(a[o]=m(r[o],e,t),a):(a[o]=n,a)},{}):r,"recursiveOmit");var y=Object.defineProperty,c=i((r,e)=>y(r,"name",{value:e,configurable:!0}),"r");const d=c(r=>Array.isArray(r)&&r.length>0,"isFullArray"),A=c((r,e)=>d(e)?m(r,e):r,"omit");export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var d=Object.defineProperty;var a=(e,r)=>d(e,"name",{value:r,configurable:!0});import u from"./isPlainObject-
|
|
1
|
+
var d=Object.defineProperty;var a=(e,r)=>d(e,"name",{value:r,configurable:!0});import u from"./isPlainObject-CKRRjQp3.js";import{c as h}from"./paths-are-equal-BYur8Hqc.js";var j=Object.defineProperty,y=a((e,r)=>j(e,"name",{value:r,configurable:!0}),"a$1");const f=y((e,r,s="")=>u(e)?Object.entries(e).reduce((l,[i,c])=>{let t=s;if(t&&(t+="."),t+=i,r.length>0){let n=!1;if(r.forEach(o=>{const v=t.split(".").length,g=o.split(".").length,m=o.split(".").slice(0,v).join("."),b=t.split(".").slice(0,g).join(".");h(b,m)&&(n=!0)}),!n)return l}return u(c)?(l[i]=f(e[i],r,t),l):(l[i]=c,l)},{}):e,"recursivePick");var P=Object.defineProperty,p=a((e,r)=>P(e,"name",{value:r,configurable:!0}),"t");const A=p(e=>Array.isArray(e)&&e.length>0,"isFullArray"),E=p((e,r)=>A(r)?f(e,r):{},"pick");export{E as default};
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/object",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.14",
|
|
4
4
|
"description": "Helper functions for working with objects and arrays.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"visulima",
|
|
7
6
|
"access",
|
|
8
7
|
"del",
|
|
9
8
|
"delete",
|
|
10
|
-
"dot notation",
|
|
11
9
|
"dot",
|
|
10
|
+
"dot notation",
|
|
12
11
|
"dotty",
|
|
13
12
|
"get",
|
|
14
13
|
"notation",
|
|
@@ -19,12 +18,11 @@
|
|
|
19
18
|
"property",
|
|
20
19
|
"set",
|
|
21
20
|
"transform",
|
|
22
|
-
"typescript"
|
|
21
|
+
"typescript",
|
|
22
|
+
"visulima"
|
|
23
23
|
],
|
|
24
24
|
"homepage": "https://visulima.com/packages/object",
|
|
25
|
-
"bugs":
|
|
26
|
-
"url": "https://github.com/visulima/visulima/issues"
|
|
27
|
-
},
|
|
25
|
+
"bugs": "https://github.com/visulima/visulima/issues",
|
|
28
26
|
"repository": {
|
|
29
27
|
"type": "git",
|
|
30
28
|
"url": "git+https://github.com/visulima/visulima.git",
|
|
@@ -59,9 +57,6 @@
|
|
|
59
57
|
"README.md",
|
|
60
58
|
"CHANGELOG.md"
|
|
61
59
|
],
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"type-fest": "5.6.0"
|
|
64
|
-
},
|
|
65
60
|
"engines": {
|
|
66
61
|
"node": "^22.14.0 || >=24.10.0"
|
|
67
62
|
},
|
package/dist/omit.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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 "type-fest";
|
|
9
|
-
/**
|
|
10
|
-
* Omit returns a new object without the props you omit.
|
|
11
|
-
* @template T
|
|
12
|
-
* @template K
|
|
13
|
-
* @param object the target object to omit props from
|
|
14
|
-
* @param keys the prop names you want to omit
|
|
15
|
-
* @returns a new object without the omitted props
|
|
16
|
-
*/
|
|
17
|
-
declare const omit: <T extends { [key in string]: unknown; }, K extends string>(object: T, keys: Paths<T>[]) => OmitDeep<T, K>;
|
|
18
|
-
export default omit;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var v=Object.defineProperty;var i=(r,e)=>v(r,"name",{value:e,configurable:!0});import m from"./isPlainObject-CLTs8VdF.js";import{c as s}from"./paths-are-equal-BYur8Hqc.js";var b=Object.defineProperty,p=i((r,e)=>b(r,"name",{value:e,configurable:!0}),"u");const c=p((r,e,f="")=>m(r)?Object.entries(r).reduce((a,[t,u])=>{let o=f;return o&&(o+="."),o+=t,e.some(n=>s(o,n))?a:m(u)?(a[t]=c(r[t],e,o),a):(a[t]=u,a)},{}):r,"recursiveOmit");var y=Object.defineProperty,l=i((r,e)=>y(r,"name",{value:e,configurable:!0}),"r");const d=l(r=>Array.isArray(r)&&r.length>0,"isFullArray"),A=l((r,e)=>d(e)?c(r,e):r,"omit");export{A as default};
|
package/dist/pick.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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 "type-fest";
|
|
9
|
-
/**
|
|
10
|
-
* Pick returns a new object with only the props you pick.
|
|
11
|
-
* @template T
|
|
12
|
-
* @template K
|
|
13
|
-
* @param object the target object to pick props from
|
|
14
|
-
* @param 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 } }`
|
|
15
|
-
* @returns a new object with just the picked props
|
|
16
|
-
*/
|
|
17
|
-
declare const pick: <T extends { [key in string]: unknown; }, K extends Paths<T>>(object: T, keys: Paths<T>[]) => PickDeep<T, K>;
|
|
18
|
-
export default pick;
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
/**
|
|
9
|
-
* PathsAreEqual returns true if the path and wildcardPath are equal.
|
|
10
|
-
* @param path The path to compare
|
|
11
|
-
* @param wildcardPath The wildcard path to compare
|
|
12
|
-
* @returns True if the path and wildcardPath are equal, false otherwise.
|
|
13
|
-
*/
|
|
14
|
-
declare const pathsAreEqual: (path: string, wildcardPath: string) => boolean;
|
|
15
|
-
export default pathsAreEqual;
|