@visulima/object 1.0.5 → 1.0.7
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 +26 -0
- package/LICENSE.md +129 -18
- package/README.md +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +36 -51
- package/dist/index.d.mts +36 -51
- package/dist/index.d.ts +36 -51
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/getProperty-Crh_HruK.cjs +1 -0
- package/dist/packem_shared/getProperty-D2xQpEOY.mjs +1 -0
- package/dist/packem_shared/isPlainObject-CLTs8VdF.mjs +1 -0
- package/dist/packem_shared/isPlainObject-Ct8-08mJ.cjs +1 -0
- package/dist/packem_shared/omit-BQOPjoaX.cjs +1 -0
- package/dist/packem_shared/omit-BcaD2qRn.mjs +1 -0
- package/dist/packem_shared/pick-BxgLK1bH.mjs +1 -0
- package/dist/packem_shared/{pick-CkwC0jUm.cjs → pick-fC8KqJig.cjs} +1 -1
- package/package.json +13 -13
- package/dist/packem_shared/getProperty-C5Q_YpVO.mjs +0 -1
- package/dist/packem_shared/getProperty-D34HTBAJ.cjs +0 -1
- package/dist/packem_shared/isPlainObject-BTLAczOE.cjs +0 -1
- package/dist/packem_shared/isPlainObject-CFPUbgRS.mjs +0 -1
- package/dist/packem_shared/omit-Cwc8rJUb.cjs +0 -1
- package/dist/packem_shared/omit-Df-0bpNu.mjs +0 -1
- package/dist/packem_shared/pick-CS1_JC9v.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## @visulima/object [1.0.7](https://github.com/visulima/visulima/compare/@visulima/object@1.0.6...@visulima/object@1.0.7) (2024-12-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* allow node v23 ([8ca929a](https://github.com/visulima/visulima/commit/8ca929af311ce8036cbbfde68b6db05381b860a5))
|
|
6
|
+
* allowed node 23, updated dev dependencies ([f99d34e](https://github.com/visulima/visulima/commit/f99d34e01f6b13be8586a1b5d37dc8b8df0a5817))
|
|
7
|
+
* updated packem to v1.8.2 ([23f869b](https://github.com/visulima/visulima/commit/23f869b4120856cc97e2bffa6d508e2ae30420ea))
|
|
8
|
+
|
|
9
|
+
### Styles
|
|
10
|
+
|
|
11
|
+
* cs fixes ([46d31e0](https://github.com/visulima/visulima/commit/46d31e082e1865262bf380859c14fabd28ff456d))
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* updated dev dependencies ([a916944](https://github.com/visulima/visulima/commit/a916944b888bb34c34b0c54328b38d29e4399857))
|
|
16
|
+
|
|
17
|
+
## @visulima/object [1.0.6](https://github.com/visulima/visulima/compare/@visulima/object@1.0.5...@visulima/object@1.0.6) (2024-10-05)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* updated dev dependencies, updated packem to v1.0.7, fixed naming of some lint config files ([c071a9c](https://github.com/visulima/visulima/commit/c071a9c8e129014a962ff654a16f302ca18a5c67))
|
|
22
|
+
|
|
23
|
+
### Miscellaneous Chores
|
|
24
|
+
|
|
25
|
+
* updated dev dependencies ([736c6ce](https://github.com/visulima/visulima/commit/736c6ce7270b3e525a8ea9f79646a2a3fde47d4e))
|
|
26
|
+
|
|
1
27
|
## @visulima/object [1.0.5](https://github.com/visulima/visulima/compare/@visulima/object@1.0.4...@visulima/object@1.0.5) (2024-09-24)
|
|
2
28
|
|
|
3
29
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -23,22 +23,18 @@ SOFTWARE.
|
|
|
23
23
|
<!-- DEPENDENCIES -->
|
|
24
24
|
|
|
25
25
|
# Licenses of bundled dependencies
|
|
26
|
-
|
|
27
26
|
The published @visulima/object artifact additionally contains code with the following licenses:
|
|
28
27
|
MIT
|
|
29
28
|
|
|
30
29
|
# Bundled dependencies:
|
|
31
|
-
|
|
32
30
|
## deeks
|
|
33
|
-
|
|
34
31
|
License: MIT
|
|
35
32
|
By: mrodrig
|
|
36
33
|
Repository: git+https://github.com/mrodrig/deeks.git
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
---------------------------------------
|
|
39
36
|
|
|
40
37
|
## dot-prop
|
|
41
|
-
|
|
42
38
|
License: MIT
|
|
43
39
|
By: Sindre Sorhus
|
|
44
40
|
Repository: sindresorhus/dot-prop
|
|
@@ -53,10 +49,9 @@ Repository: sindresorhus/dot-prop
|
|
|
53
49
|
>
|
|
54
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.
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
---------------------------------------
|
|
57
53
|
|
|
58
54
|
## is-plain-obj
|
|
59
|
-
|
|
60
55
|
License: MIT
|
|
61
56
|
By: Sindre Sorhus
|
|
62
57
|
Repository: sindresorhus/is-plain-obj
|
|
@@ -71,27 +66,23 @@ Repository: sindresorhus/is-plain-obj
|
|
|
71
66
|
>
|
|
72
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.
|
|
73
68
|
|
|
74
|
-
<!-- DEPENDENCIES -->
|
|
69
|
+
<!-- /DEPENDENCIES -->
|
|
75
70
|
|
|
76
71
|
<!-- TYPE_DEPENDENCIES -->
|
|
77
72
|
|
|
78
73
|
# Licenses of bundled types
|
|
79
|
-
|
|
80
74
|
The published @visulima/object artifact additionally contains code with the following licenses:
|
|
81
75
|
MIT, (MIT OR CC0-1.0)
|
|
82
76
|
|
|
83
77
|
# Bundled types:
|
|
84
|
-
|
|
85
78
|
## deeks
|
|
86
|
-
|
|
87
79
|
License: MIT
|
|
88
80
|
By: mrodrig
|
|
89
81
|
Repository: git+https://github.com/mrodrig/deeks.git
|
|
90
82
|
|
|
91
|
-
|
|
83
|
+
---------------------------------------
|
|
92
84
|
|
|
93
85
|
## dot-prop
|
|
94
|
-
|
|
95
86
|
License: MIT
|
|
96
87
|
By: Sindre Sorhus
|
|
97
88
|
Repository: sindresorhus/dot-prop
|
|
@@ -106,10 +97,9 @@ Repository: sindresorhus/dot-prop
|
|
|
106
97
|
>
|
|
107
98
|
> 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.
|
|
108
99
|
|
|
109
|
-
|
|
100
|
+
---------------------------------------
|
|
110
101
|
|
|
111
102
|
## is-plain-obj
|
|
112
|
-
|
|
113
103
|
License: MIT
|
|
114
104
|
By: Sindre Sorhus
|
|
115
105
|
Repository: sindresorhus/is-plain-obj
|
|
@@ -124,12 +114,133 @@ Repository: sindresorhus/is-plain-obj
|
|
|
124
114
|
>
|
|
125
115
|
> 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.
|
|
126
116
|
|
|
127
|
-
|
|
117
|
+
---------------------------------------
|
|
128
118
|
|
|
129
119
|
## type-fest
|
|
130
|
-
|
|
131
120
|
License: (MIT OR CC0-1.0)
|
|
132
121
|
By: Sindre Sorhus
|
|
133
122
|
Repository: sindresorhus/type-fest
|
|
134
123
|
|
|
135
|
-
|
|
124
|
+
> Creative Commons Legal Code
|
|
125
|
+
>
|
|
126
|
+
> CC0 1.0 Universal
|
|
127
|
+
>
|
|
128
|
+
> CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
129
|
+
> LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
130
|
+
> ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
131
|
+
> INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
132
|
+
> REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
133
|
+
> PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
134
|
+
> THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
135
|
+
> HEREUNDER.
|
|
136
|
+
>
|
|
137
|
+
> Statement of Purpose
|
|
138
|
+
>
|
|
139
|
+
> The laws of most jurisdictions throughout the world automatically confer
|
|
140
|
+
> exclusive Copyright and Related Rights (defined below) upon the creator
|
|
141
|
+
> and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
142
|
+
> authorship and/or a database (each, a "Work").
|
|
143
|
+
>
|
|
144
|
+
> Certain owners wish to permanently relinquish those rights to a Work for
|
|
145
|
+
> the purpose of contributing to a commons of creative, cultural and
|
|
146
|
+
> scientific works ("Commons") that the public can reliably and without fear
|
|
147
|
+
> of later claims of infringement build upon, modify, incorporate in other
|
|
148
|
+
> works, reuse and redistribute as freely as possible in any form whatsoever
|
|
149
|
+
> and for any purposes, including without limitation commercial purposes.
|
|
150
|
+
> These owners may contribute to the Commons to promote the ideal of a free
|
|
151
|
+
> culture and the further production of creative, cultural and scientific
|
|
152
|
+
> works, or to gain reputation or greater distribution for their Work in
|
|
153
|
+
> part through the use and efforts of others.
|
|
154
|
+
>
|
|
155
|
+
> For these and/or other purposes and motivations, and without any
|
|
156
|
+
> expectation of additional consideration or compensation, the person
|
|
157
|
+
> associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
158
|
+
> is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
159
|
+
> elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
160
|
+
> terms, with knowledge of his or her Copyright and Related Rights in the
|
|
161
|
+
> Work and the meaning and intended legal effect of CC0 on those rights.
|
|
162
|
+
>
|
|
163
|
+
> 1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
164
|
+
> protected by copyright and related or neighboring rights ("Copyright and
|
|
165
|
+
> Related Rights"). Copyright and Related Rights include, but are not
|
|
166
|
+
> limited to, the following:
|
|
167
|
+
>
|
|
168
|
+
> i. the right to reproduce, adapt, distribute, perform, display,
|
|
169
|
+
> communicate, and translate a Work;
|
|
170
|
+
> ii. moral rights retained by the original author(s) and/or performer(s);
|
|
171
|
+
> iii. publicity and privacy rights pertaining to a person's image or
|
|
172
|
+
> likeness depicted in a Work;
|
|
173
|
+
> iv. rights protecting against unfair competition in regards to a Work,
|
|
174
|
+
> subject to the limitations in paragraph 4(a), below;
|
|
175
|
+
> v. rights protecting the extraction, dissemination, use and reuse of data
|
|
176
|
+
> in a Work;
|
|
177
|
+
> vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
178
|
+
> European Parliament and of the Council of 11 March 1996 on the legal
|
|
179
|
+
> protection of databases, and under any national implementation
|
|
180
|
+
> thereof, including any amended or successor version of such
|
|
181
|
+
> directive); and
|
|
182
|
+
> vii. other similar, equivalent or corresponding rights throughout the
|
|
183
|
+
> world based on applicable law or treaty, and any national
|
|
184
|
+
> implementations thereof.
|
|
185
|
+
>
|
|
186
|
+
> 2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
187
|
+
> of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
188
|
+
> irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
189
|
+
> Affirmer's Copyright and Related Rights and associated claims and causes
|
|
190
|
+
> of action, whether now known or unknown (including existing as well as
|
|
191
|
+
> future claims and causes of action), in the Work (i) in all territories
|
|
192
|
+
> worldwide, (ii) for the maximum duration provided by applicable law or
|
|
193
|
+
> treaty (including future time extensions), (iii) in any current or future
|
|
194
|
+
> medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
195
|
+
> including without limitation commercial, advertising or promotional
|
|
196
|
+
> purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
197
|
+
> member of the public at large and to the detriment of Affirmer's heirs and
|
|
198
|
+
> successors, fully intending that such Waiver shall not be subject to
|
|
199
|
+
> revocation, rescission, cancellation, termination, or any other legal or
|
|
200
|
+
> equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
201
|
+
> as contemplated by Affirmer's express Statement of Purpose.
|
|
202
|
+
>
|
|
203
|
+
> 3. Public License Fallback. Should any part of the Waiver for any reason
|
|
204
|
+
> be judged legally invalid or ineffective under applicable law, then the
|
|
205
|
+
> Waiver shall be preserved to the maximum extent permitted taking into
|
|
206
|
+
> account Affirmer's express Statement of Purpose. In addition, to the
|
|
207
|
+
> extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
208
|
+
> person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
209
|
+
> irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
210
|
+
> Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
211
|
+
> maximum duration provided by applicable law or treaty (including future
|
|
212
|
+
> time extensions), (iii) in any current or future medium and for any number
|
|
213
|
+
> of copies, and (iv) for any purpose whatsoever, including without
|
|
214
|
+
> limitation commercial, advertising or promotional purposes (the
|
|
215
|
+
> "License"). The License shall be deemed effective as of the date CC0 was
|
|
216
|
+
> applied by Affirmer to the Work. Should any part of the License for any
|
|
217
|
+
> reason be judged legally invalid or ineffective under applicable law, such
|
|
218
|
+
> partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
219
|
+
> of the License, and in such case Affirmer hereby affirms that he or she
|
|
220
|
+
> will not (i) exercise any of his or her remaining Copyright and Related
|
|
221
|
+
> Rights in the Work or (ii) assert any associated claims and causes of
|
|
222
|
+
> action with respect to the Work, in either case contrary to Affirmer's
|
|
223
|
+
> express Statement of Purpose.
|
|
224
|
+
>
|
|
225
|
+
> 4. Limitations and Disclaimers.
|
|
226
|
+
>
|
|
227
|
+
> a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
228
|
+
> surrendered, licensed or otherwise affected by this document.
|
|
229
|
+
> b. Affirmer offers the Work as-is and makes no representations or
|
|
230
|
+
> warranties of any kind concerning the Work, express, implied,
|
|
231
|
+
> statutory or otherwise, including without limitation warranties of
|
|
232
|
+
> title, merchantability, fitness for a particular purpose, non
|
|
233
|
+
> infringement, or the absence of latent or other defects, accuracy, or
|
|
234
|
+
> the present or absence of errors, whether or not discoverable, all to
|
|
235
|
+
> the greatest extent permissible under applicable law.
|
|
236
|
+
> c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
237
|
+
> that may apply to the Work or any use thereof, including without
|
|
238
|
+
> limitation any person's Copyright and Related Rights in the Work.
|
|
239
|
+
> Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
240
|
+
> consents, permissions or other rights required for any use of the
|
|
241
|
+
> Work.
|
|
242
|
+
> d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
243
|
+
> party to this document and has no duty or obligation with respect to
|
|
244
|
+
> this CC0 or use of the Work.
|
|
245
|
+
|
|
246
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -101,12 +101,12 @@ omit(doc, ["items.discard"]);
|
|
|
101
101
|
|
|
102
102
|
## Related
|
|
103
103
|
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
104
|
+
- [is-plain-object](https://github.com/jonschlinkert/is-plain-object) - Returns true if the given value is an object created by the Object constructor.
|
|
105
|
+
- [is-plain-obj][is-plain-obj] - Check if a value is a plain object.
|
|
106
|
+
- [dot-prop][dot-prop] - Get, set, or delete a property from a nested object using a dot path.
|
|
107
|
+
- [ts-dot-prop](https://github.com/justinlettau/ts-dot-prop) - TypeScript utility to transform nested objects using a dot notation path.
|
|
108
|
+
- [dset](https://www.npmjs.com/package/dset) - A tiny (194B) utility for safely writing deep Object values~!
|
|
109
|
+
- [filter-anything](https://github.com/mesqueeb/filter-anything) - A simple (TypeScript) integration of "pick" and "omit" to filter props of an object.
|
|
110
110
|
|
|
111
111
|
## Supported Node.js Versions
|
|
112
112
|
|
|
@@ -121,8 +121,8 @@ If you would like to help take a look at the [list of issues](https://github.com
|
|
|
121
121
|
|
|
122
122
|
## Credits
|
|
123
123
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
124
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
125
|
+
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
126
126
|
|
|
127
127
|
## License
|
|
128
128
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var L=Object.defineProperty;var a=(c,p)=>L(c,"name",{value:p,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./packem_shared/omit-BQOPjoaX.cjs"),N=require("./packem_shared/pick-fC8KqJig.cjs"),b=require("./packem_shared/getProperty-Crh_HruK.cjs"),R=require("./packem_shared/isPlainObject-Ct8-08mJ.cjs");var s={},y={},D;function T(){if(D)return y;D=1;var c=Object.defineProperty,p=a((o,m)=>c(o,"name",{value:m,configurable:!0}),"t");Object.defineProperty(y,"__esModule",{value:!0}),y.isDocumentToRecurOn=y.flatten=y.unique=void 0;function u(o){return[...new Set(o)]}a(u,"unique"),p(u,"unique"),y.unique=u;function l(o){return[].concat(...o)}a(l,"flatten"),p(l,"flatten"),y.flatten=l;function g(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)&&Object.keys(o).length}return a(g,"isDocumentToRecurOn"),p(g,"isDocumentToRecurOn"),y.isDocumentToRecurOn=g,y}a(T,"requireUtils");var K={},q;function E(){return q||(q=1,Object.defineProperty(K,"__esModule",{value:!0})),K}a(E,"requireTypes");var S;function x(){return S||(S=1,function(c){var p=Object.defineProperty,u=a((r,e)=>p(r,"name",{value:e,configurable:!0}),"i"),l=s&&s.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:u(function(){return e[t]},"get")}),Object.defineProperty(r,i,n)}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),g=s&&s.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),o=s&&s.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&l(e,r,t);return g(e,r),e},m=s&&s.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&l(e,r,t)};Object.defineProperty(c,"__esModule",{value:!0}),c.deepKeysFromList=c.deepKeys=void 0;const d=o(T());m(E(),c);function O(r,e){const t=A(e);return typeof r=="object"&&r!==null?_("",r,t):[]}a(O,"deepKeys"),u(O,"deepKeys"),c.deepKeys=O;function v(r,e){const t=A(e);return r.map(i=>typeof i=="object"&&i!==null?O(i,t):[])}a(v,"deepKeysFromList"),u(v,"deepKeysFromList"),c.deepKeysFromList=v;function _(r,e,t){const i=Object.keys(e).map(n=>{const f=P(r,j(n,t));return t.expandNestedObjects&&d.isDocumentToRecurOn(e[n])||t.arrayIndexesAsKeys&&Array.isArray(e[n])&&e[n].length?_(f,e[n],t):t.expandArrayObjects&&Array.isArray(e[n])?h(e[n],f,t):t.ignoreEmptyArrays&&Array.isArray(e[n])&&!e[n].length?[]:f});return d.flatten(i)}a(_,"generateDeepKeysList"),u(_,"generateDeepKeysList");function h(r,e,t){let i=v(r,t);return r.length?r.length&&d.flatten(i).length===0?[e]:(i=i.map(n=>Array.isArray(n)&&n.length===0?[e]:n.map(f=>P(e,j(f,t)))),d.unique(d.flatten(i))):t.ignoreEmptyArraysWhenExpanding?[]:[e]}a(h,"processArrayKeys"),u(h,"processArrayKeys");function j(r,e){return e.escapeNestedDots?r.replace(/\./g,"\\."):r}a(j,"escapeNestedDotsIfSpecified"),u(j,"escapeNestedDotsIfSpecified");function P(r,e){return r?r+"."+e:e}a(P,"buildKeyName"),u(P,"buildKeyName");function A(r){return{arrayIndexesAsKeys:!1,expandNestedObjects:!0,expandArrayObjects:!1,ignoreEmptyArraysWhenExpanding:!1,escapeNestedDots:!1,ignoreEmptyArrays:!1,...r??{}}}a(A,"mergeOptions"),u(A,"mergeOptions")}(s)),s}a(x,"requireDeeks");var k=x();exports.omit=M;exports.pick=N;exports.deleteProperty=b.deleteProperty;exports.escapePath=b.escapePath;exports.getProperty=b.getProperty;exports.hasProperty=b.hasProperty;exports.setProperty=b.setProperty;exports.isPlainObject=R;exports.deepKeys=k.deepKeys;exports.deepKeysFromList=k.deepKeysFromList;
|
package/dist/index.d.cts
CHANGED
|
@@ -231,6 +231,10 @@ type IsArrayReadonly<T extends UnknownArray> = T extends unknown[] ? false : tru
|
|
|
231
231
|
|
|
232
232
|
type StringDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
233
233
|
|
|
234
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
235
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
236
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
237
|
+
|
|
234
238
|
/**
|
|
235
239
|
Returns a boolean for whether the given type is `any`.
|
|
236
240
|
|
|
@@ -259,7 +263,7 @@ const anyA = get(anyObject, 'a');
|
|
|
259
263
|
@category Type Guard
|
|
260
264
|
@category Utilities
|
|
261
265
|
*/
|
|
262
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
266
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
263
267
|
|
|
264
268
|
type Numeric = number | bigint;
|
|
265
269
|
|
|
@@ -866,41 +870,6 @@ Matches non-recursive types.
|
|
|
866
870
|
*/
|
|
867
871
|
type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
|
|
868
872
|
|
|
869
|
-
/**
|
|
870
|
-
Returns a boolean for whether the given type is a union type.
|
|
871
|
-
|
|
872
|
-
@example
|
|
873
|
-
```
|
|
874
|
-
type A = IsUnion<string | number>;
|
|
875
|
-
//=> true
|
|
876
|
-
|
|
877
|
-
type B = IsUnion<string>;
|
|
878
|
-
//=> false
|
|
879
|
-
```
|
|
880
|
-
*/
|
|
881
|
-
type IsUnion<T> = InternalIsUnion<T>;
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
The actual implementation of `IsUnion`.
|
|
885
|
-
*/
|
|
886
|
-
type InternalIsUnion<T, U = T> =
|
|
887
|
-
(
|
|
888
|
-
// @link https://ghaiklor.github.io/type-challenges-solutions/en/medium-isunion.html
|
|
889
|
-
IsNever<T> extends true
|
|
890
|
-
? false
|
|
891
|
-
: T extends any
|
|
892
|
-
? [U] extends [T]
|
|
893
|
-
? false
|
|
894
|
-
: true
|
|
895
|
-
: never
|
|
896
|
-
) extends infer Result
|
|
897
|
-
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
898
|
-
// that means `T` has at least two types and it's a union type,
|
|
899
|
-
// so we will return `true` instead of `boolean`.
|
|
900
|
-
? boolean extends Result ? true
|
|
901
|
-
: Result
|
|
902
|
-
: never; // Should never happen
|
|
903
|
-
|
|
904
873
|
/**
|
|
905
874
|
Create an object type with the given key `<Key>` and value `<Value>`.
|
|
906
875
|
|
|
@@ -1725,13 +1694,13 @@ type Dog = {
|
|
|
1725
1694
|
function displayPetInfo(petInfo: (Cat | Dog)['info']) {
|
|
1726
1695
|
// typeof petInfo =>
|
|
1727
1696
|
// {
|
|
1728
|
-
//
|
|
1729
|
-
//
|
|
1730
|
-
//
|
|
1697
|
+
// name: string;
|
|
1698
|
+
// type: 'cat';
|
|
1699
|
+
// catType: string; // Needn't care about this field, because it's not a common pet info field.
|
|
1731
1700
|
// } | {
|
|
1732
|
-
//
|
|
1733
|
-
//
|
|
1734
|
-
//
|
|
1701
|
+
// name: string;
|
|
1702
|
+
// type: 'dog';
|
|
1703
|
+
// dogType: string; // Needn't care about this field, because it's not a common pet info field.
|
|
1735
1704
|
// }
|
|
1736
1705
|
|
|
1737
1706
|
// petInfo type is complex and have some needless fields
|
|
@@ -1743,8 +1712,8 @@ function displayPetInfo(petInfo: (Cat | Dog)['info']) {
|
|
|
1743
1712
|
function displayPetInfo(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {
|
|
1744
1713
|
// typeof petInfo =>
|
|
1745
1714
|
// {
|
|
1746
|
-
//
|
|
1747
|
-
//
|
|
1715
|
+
// name: string;
|
|
1716
|
+
// type: 'cat' | 'dog';
|
|
1748
1717
|
// }
|
|
1749
1718
|
|
|
1750
1719
|
// petInfo type is simple and clear
|
|
@@ -1754,17 +1723,16 @@ function displayPetInfo(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {
|
|
|
1754
1723
|
}
|
|
1755
1724
|
```
|
|
1756
1725
|
|
|
1726
|
+
@see SharedUnionFields
|
|
1727
|
+
|
|
1757
1728
|
@category Object
|
|
1758
1729
|
@category Union
|
|
1759
1730
|
*/
|
|
1760
1731
|
type SharedUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions = {recurseIntoArrays: false}> =
|
|
1761
|
-
// If `Union` is not a union type, return `Union` directly.
|
|
1762
|
-
IsUnion<Union> extends false
|
|
1763
|
-
? Union
|
|
1764
1732
|
// `Union extends` will convert `Union`
|
|
1765
1733
|
// to a [distributive conditionaltype](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
1766
1734
|
// But this is not what we want, so we need to wrap `Union` with `[]` to prevent it.
|
|
1767
|
-
|
|
1735
|
+
[Union] extends [NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>]
|
|
1768
1736
|
? Union
|
|
1769
1737
|
: [Union] extends [UnknownArray]
|
|
1770
1738
|
? Options['recurseIntoArrays'] extends true
|
|
@@ -1778,13 +1746,18 @@ IsUnion<Union> extends false
|
|
|
1778
1746
|
Same as `SharedUnionFieldsDeep`, but accepts only `object`s and as inputs. Internal helper for `SharedUnionFieldsDeep`.
|
|
1779
1747
|
*/
|
|
1780
1748
|
type SharedObjectUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions> =
|
|
1749
|
+
// `keyof Union` can extract the same key in union type, if there is no same key, return never.
|
|
1781
1750
|
keyof Union extends infer Keys
|
|
1782
1751
|
? IsNever<Keys> extends false
|
|
1783
1752
|
? {
|
|
1784
1753
|
[Key in keyof Union]:
|
|
1785
1754
|
Union[Key] extends NonRecursiveType
|
|
1786
1755
|
? Union[Key]
|
|
1787
|
-
|
|
1756
|
+
// Remove `undefined` from the union to support optional
|
|
1757
|
+
// fields, then recover `undefined` if union was already undefined.
|
|
1758
|
+
: SharedUnionFieldsDeep<Exclude<Union[Key], undefined>, Options> | (
|
|
1759
|
+
undefined extends Required<Union>[Key] ? undefined : never
|
|
1760
|
+
)
|
|
1788
1761
|
}
|
|
1789
1762
|
: {}
|
|
1790
1763
|
: Union;
|
|
@@ -2173,8 +2146,20 @@ type PropertyOf<BaseType, Key extends string, Options extends GetOptions = {}> =
|
|
|
2173
2146
|
? undefined
|
|
2174
2147
|
: Key extends keyof BaseType
|
|
2175
2148
|
? StrictPropertyOf<BaseType, Key, Options>
|
|
2176
|
-
|
|
2177
|
-
|
|
2149
|
+
// Handle arrays and tuples
|
|
2150
|
+
: BaseType extends readonly unknown[]
|
|
2151
|
+
? Key extends `${number}`
|
|
2152
|
+
// For arrays with unknown length (regular arrays)
|
|
2153
|
+
? number extends BaseType['length']
|
|
2154
|
+
? Strictify<BaseType[number], Options>
|
|
2155
|
+
// For tuples: check if the index is valid
|
|
2156
|
+
: Key extends keyof BaseType
|
|
2157
|
+
? Strictify<BaseType[Key & keyof BaseType], Options>
|
|
2158
|
+
// Out-of-bounds access for tuples
|
|
2159
|
+
: unknown
|
|
2160
|
+
// Non-numeric string key for arrays/tuples
|
|
2161
|
+
: unknown
|
|
2162
|
+
// Handle array-like objects
|
|
2178
2163
|
: BaseType extends {
|
|
2179
2164
|
[n: number]: infer Item;
|
|
2180
2165
|
length: number; // Note: This is needed to avoid being too lax with records types using number keys like `{0: string; 1: boolean}`.
|
package/dist/index.d.mts
CHANGED
|
@@ -231,6 +231,10 @@ type IsArrayReadonly<T extends UnknownArray> = T extends unknown[] ? false : tru
|
|
|
231
231
|
|
|
232
232
|
type StringDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
233
233
|
|
|
234
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
235
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
236
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
237
|
+
|
|
234
238
|
/**
|
|
235
239
|
Returns a boolean for whether the given type is `any`.
|
|
236
240
|
|
|
@@ -259,7 +263,7 @@ const anyA = get(anyObject, 'a');
|
|
|
259
263
|
@category Type Guard
|
|
260
264
|
@category Utilities
|
|
261
265
|
*/
|
|
262
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
266
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
263
267
|
|
|
264
268
|
type Numeric = number | bigint;
|
|
265
269
|
|
|
@@ -866,41 +870,6 @@ Matches non-recursive types.
|
|
|
866
870
|
*/
|
|
867
871
|
type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
|
|
868
872
|
|
|
869
|
-
/**
|
|
870
|
-
Returns a boolean for whether the given type is a union type.
|
|
871
|
-
|
|
872
|
-
@example
|
|
873
|
-
```
|
|
874
|
-
type A = IsUnion<string | number>;
|
|
875
|
-
//=> true
|
|
876
|
-
|
|
877
|
-
type B = IsUnion<string>;
|
|
878
|
-
//=> false
|
|
879
|
-
```
|
|
880
|
-
*/
|
|
881
|
-
type IsUnion<T> = InternalIsUnion<T>;
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
The actual implementation of `IsUnion`.
|
|
885
|
-
*/
|
|
886
|
-
type InternalIsUnion<T, U = T> =
|
|
887
|
-
(
|
|
888
|
-
// @link https://ghaiklor.github.io/type-challenges-solutions/en/medium-isunion.html
|
|
889
|
-
IsNever<T> extends true
|
|
890
|
-
? false
|
|
891
|
-
: T extends any
|
|
892
|
-
? [U] extends [T]
|
|
893
|
-
? false
|
|
894
|
-
: true
|
|
895
|
-
: never
|
|
896
|
-
) extends infer Result
|
|
897
|
-
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
898
|
-
// that means `T` has at least two types and it's a union type,
|
|
899
|
-
// so we will return `true` instead of `boolean`.
|
|
900
|
-
? boolean extends Result ? true
|
|
901
|
-
: Result
|
|
902
|
-
: never; // Should never happen
|
|
903
|
-
|
|
904
873
|
/**
|
|
905
874
|
Create an object type with the given key `<Key>` and value `<Value>`.
|
|
906
875
|
|
|
@@ -1725,13 +1694,13 @@ type Dog = {
|
|
|
1725
1694
|
function displayPetInfo(petInfo: (Cat | Dog)['info']) {
|
|
1726
1695
|
// typeof petInfo =>
|
|
1727
1696
|
// {
|
|
1728
|
-
//
|
|
1729
|
-
//
|
|
1730
|
-
//
|
|
1697
|
+
// name: string;
|
|
1698
|
+
// type: 'cat';
|
|
1699
|
+
// catType: string; // Needn't care about this field, because it's not a common pet info field.
|
|
1731
1700
|
// } | {
|
|
1732
|
-
//
|
|
1733
|
-
//
|
|
1734
|
-
//
|
|
1701
|
+
// name: string;
|
|
1702
|
+
// type: 'dog';
|
|
1703
|
+
// dogType: string; // Needn't care about this field, because it's not a common pet info field.
|
|
1735
1704
|
// }
|
|
1736
1705
|
|
|
1737
1706
|
// petInfo type is complex and have some needless fields
|
|
@@ -1743,8 +1712,8 @@ function displayPetInfo(petInfo: (Cat | Dog)['info']) {
|
|
|
1743
1712
|
function displayPetInfo(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {
|
|
1744
1713
|
// typeof petInfo =>
|
|
1745
1714
|
// {
|
|
1746
|
-
//
|
|
1747
|
-
//
|
|
1715
|
+
// name: string;
|
|
1716
|
+
// type: 'cat' | 'dog';
|
|
1748
1717
|
// }
|
|
1749
1718
|
|
|
1750
1719
|
// petInfo type is simple and clear
|
|
@@ -1754,17 +1723,16 @@ function displayPetInfo(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {
|
|
|
1754
1723
|
}
|
|
1755
1724
|
```
|
|
1756
1725
|
|
|
1726
|
+
@see SharedUnionFields
|
|
1727
|
+
|
|
1757
1728
|
@category Object
|
|
1758
1729
|
@category Union
|
|
1759
1730
|
*/
|
|
1760
1731
|
type SharedUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions = {recurseIntoArrays: false}> =
|
|
1761
|
-
// If `Union` is not a union type, return `Union` directly.
|
|
1762
|
-
IsUnion<Union> extends false
|
|
1763
|
-
? Union
|
|
1764
1732
|
// `Union extends` will convert `Union`
|
|
1765
1733
|
// to a [distributive conditionaltype](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
1766
1734
|
// But this is not what we want, so we need to wrap `Union` with `[]` to prevent it.
|
|
1767
|
-
|
|
1735
|
+
[Union] extends [NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>]
|
|
1768
1736
|
? Union
|
|
1769
1737
|
: [Union] extends [UnknownArray]
|
|
1770
1738
|
? Options['recurseIntoArrays'] extends true
|
|
@@ -1778,13 +1746,18 @@ IsUnion<Union> extends false
|
|
|
1778
1746
|
Same as `SharedUnionFieldsDeep`, but accepts only `object`s and as inputs. Internal helper for `SharedUnionFieldsDeep`.
|
|
1779
1747
|
*/
|
|
1780
1748
|
type SharedObjectUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions> =
|
|
1749
|
+
// `keyof Union` can extract the same key in union type, if there is no same key, return never.
|
|
1781
1750
|
keyof Union extends infer Keys
|
|
1782
1751
|
? IsNever<Keys> extends false
|
|
1783
1752
|
? {
|
|
1784
1753
|
[Key in keyof Union]:
|
|
1785
1754
|
Union[Key] extends NonRecursiveType
|
|
1786
1755
|
? Union[Key]
|
|
1787
|
-
|
|
1756
|
+
// Remove `undefined` from the union to support optional
|
|
1757
|
+
// fields, then recover `undefined` if union was already undefined.
|
|
1758
|
+
: SharedUnionFieldsDeep<Exclude<Union[Key], undefined>, Options> | (
|
|
1759
|
+
undefined extends Required<Union>[Key] ? undefined : never
|
|
1760
|
+
)
|
|
1788
1761
|
}
|
|
1789
1762
|
: {}
|
|
1790
1763
|
: Union;
|
|
@@ -2173,8 +2146,20 @@ type PropertyOf<BaseType, Key extends string, Options extends GetOptions = {}> =
|
|
|
2173
2146
|
? undefined
|
|
2174
2147
|
: Key extends keyof BaseType
|
|
2175
2148
|
? StrictPropertyOf<BaseType, Key, Options>
|
|
2176
|
-
|
|
2177
|
-
|
|
2149
|
+
// Handle arrays and tuples
|
|
2150
|
+
: BaseType extends readonly unknown[]
|
|
2151
|
+
? Key extends `${number}`
|
|
2152
|
+
// For arrays with unknown length (regular arrays)
|
|
2153
|
+
? number extends BaseType['length']
|
|
2154
|
+
? Strictify<BaseType[number], Options>
|
|
2155
|
+
// For tuples: check if the index is valid
|
|
2156
|
+
: Key extends keyof BaseType
|
|
2157
|
+
? Strictify<BaseType[Key & keyof BaseType], Options>
|
|
2158
|
+
// Out-of-bounds access for tuples
|
|
2159
|
+
: unknown
|
|
2160
|
+
// Non-numeric string key for arrays/tuples
|
|
2161
|
+
: unknown
|
|
2162
|
+
// Handle array-like objects
|
|
2178
2163
|
: BaseType extends {
|
|
2179
2164
|
[n: number]: infer Item;
|
|
2180
2165
|
length: number; // Note: This is needed to avoid being too lax with records types using number keys like `{0: string; 1: boolean}`.
|
package/dist/index.d.ts
CHANGED
|
@@ -231,6 +231,10 @@ type IsArrayReadonly<T extends UnknownArray> = T extends unknown[] ? false : tru
|
|
|
231
231
|
|
|
232
232
|
type StringDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
233
233
|
|
|
234
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
235
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
236
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
237
|
+
|
|
234
238
|
/**
|
|
235
239
|
Returns a boolean for whether the given type is `any`.
|
|
236
240
|
|
|
@@ -259,7 +263,7 @@ const anyA = get(anyObject, 'a');
|
|
|
259
263
|
@category Type Guard
|
|
260
264
|
@category Utilities
|
|
261
265
|
*/
|
|
262
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
266
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
263
267
|
|
|
264
268
|
type Numeric = number | bigint;
|
|
265
269
|
|
|
@@ -866,41 +870,6 @@ Matches non-recursive types.
|
|
|
866
870
|
*/
|
|
867
871
|
type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
|
|
868
872
|
|
|
869
|
-
/**
|
|
870
|
-
Returns a boolean for whether the given type is a union type.
|
|
871
|
-
|
|
872
|
-
@example
|
|
873
|
-
```
|
|
874
|
-
type A = IsUnion<string | number>;
|
|
875
|
-
//=> true
|
|
876
|
-
|
|
877
|
-
type B = IsUnion<string>;
|
|
878
|
-
//=> false
|
|
879
|
-
```
|
|
880
|
-
*/
|
|
881
|
-
type IsUnion<T> = InternalIsUnion<T>;
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
The actual implementation of `IsUnion`.
|
|
885
|
-
*/
|
|
886
|
-
type InternalIsUnion<T, U = T> =
|
|
887
|
-
(
|
|
888
|
-
// @link https://ghaiklor.github.io/type-challenges-solutions/en/medium-isunion.html
|
|
889
|
-
IsNever<T> extends true
|
|
890
|
-
? false
|
|
891
|
-
: T extends any
|
|
892
|
-
? [U] extends [T]
|
|
893
|
-
? false
|
|
894
|
-
: true
|
|
895
|
-
: never
|
|
896
|
-
) extends infer Result
|
|
897
|
-
// In some cases `Result` will return `false | true` which is `boolean`,
|
|
898
|
-
// that means `T` has at least two types and it's a union type,
|
|
899
|
-
// so we will return `true` instead of `boolean`.
|
|
900
|
-
? boolean extends Result ? true
|
|
901
|
-
: Result
|
|
902
|
-
: never; // Should never happen
|
|
903
|
-
|
|
904
873
|
/**
|
|
905
874
|
Create an object type with the given key `<Key>` and value `<Value>`.
|
|
906
875
|
|
|
@@ -1725,13 +1694,13 @@ type Dog = {
|
|
|
1725
1694
|
function displayPetInfo(petInfo: (Cat | Dog)['info']) {
|
|
1726
1695
|
// typeof petInfo =>
|
|
1727
1696
|
// {
|
|
1728
|
-
//
|
|
1729
|
-
//
|
|
1730
|
-
//
|
|
1697
|
+
// name: string;
|
|
1698
|
+
// type: 'cat';
|
|
1699
|
+
// catType: string; // Needn't care about this field, because it's not a common pet info field.
|
|
1731
1700
|
// } | {
|
|
1732
|
-
//
|
|
1733
|
-
//
|
|
1734
|
-
//
|
|
1701
|
+
// name: string;
|
|
1702
|
+
// type: 'dog';
|
|
1703
|
+
// dogType: string; // Needn't care about this field, because it's not a common pet info field.
|
|
1735
1704
|
// }
|
|
1736
1705
|
|
|
1737
1706
|
// petInfo type is complex and have some needless fields
|
|
@@ -1743,8 +1712,8 @@ function displayPetInfo(petInfo: (Cat | Dog)['info']) {
|
|
|
1743
1712
|
function displayPetInfo(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {
|
|
1744
1713
|
// typeof petInfo =>
|
|
1745
1714
|
// {
|
|
1746
|
-
//
|
|
1747
|
-
//
|
|
1715
|
+
// name: string;
|
|
1716
|
+
// type: 'cat' | 'dog';
|
|
1748
1717
|
// }
|
|
1749
1718
|
|
|
1750
1719
|
// petInfo type is simple and clear
|
|
@@ -1754,17 +1723,16 @@ function displayPetInfo(petInfo: SharedUnionFieldsDeep<Cat | Dog>['info']) {
|
|
|
1754
1723
|
}
|
|
1755
1724
|
```
|
|
1756
1725
|
|
|
1726
|
+
@see SharedUnionFields
|
|
1727
|
+
|
|
1757
1728
|
@category Object
|
|
1758
1729
|
@category Union
|
|
1759
1730
|
*/
|
|
1760
1731
|
type SharedUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions = {recurseIntoArrays: false}> =
|
|
1761
|
-
// If `Union` is not a union type, return `Union` directly.
|
|
1762
|
-
IsUnion<Union> extends false
|
|
1763
|
-
? Union
|
|
1764
1732
|
// `Union extends` will convert `Union`
|
|
1765
1733
|
// to a [distributive conditionaltype](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
1766
1734
|
// But this is not what we want, so we need to wrap `Union` with `[]` to prevent it.
|
|
1767
|
-
|
|
1735
|
+
[Union] extends [NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>]
|
|
1768
1736
|
? Union
|
|
1769
1737
|
: [Union] extends [UnknownArray]
|
|
1770
1738
|
? Options['recurseIntoArrays'] extends true
|
|
@@ -1778,13 +1746,18 @@ IsUnion<Union> extends false
|
|
|
1778
1746
|
Same as `SharedUnionFieldsDeep`, but accepts only `object`s and as inputs. Internal helper for `SharedUnionFieldsDeep`.
|
|
1779
1747
|
*/
|
|
1780
1748
|
type SharedObjectUnionFieldsDeep<Union, Options extends SharedUnionFieldsDeepOptions> =
|
|
1749
|
+
// `keyof Union` can extract the same key in union type, if there is no same key, return never.
|
|
1781
1750
|
keyof Union extends infer Keys
|
|
1782
1751
|
? IsNever<Keys> extends false
|
|
1783
1752
|
? {
|
|
1784
1753
|
[Key in keyof Union]:
|
|
1785
1754
|
Union[Key] extends NonRecursiveType
|
|
1786
1755
|
? Union[Key]
|
|
1787
|
-
|
|
1756
|
+
// Remove `undefined` from the union to support optional
|
|
1757
|
+
// fields, then recover `undefined` if union was already undefined.
|
|
1758
|
+
: SharedUnionFieldsDeep<Exclude<Union[Key], undefined>, Options> | (
|
|
1759
|
+
undefined extends Required<Union>[Key] ? undefined : never
|
|
1760
|
+
)
|
|
1788
1761
|
}
|
|
1789
1762
|
: {}
|
|
1790
1763
|
: Union;
|
|
@@ -2173,8 +2146,20 @@ type PropertyOf<BaseType, Key extends string, Options extends GetOptions = {}> =
|
|
|
2173
2146
|
? undefined
|
|
2174
2147
|
: Key extends keyof BaseType
|
|
2175
2148
|
? StrictPropertyOf<BaseType, Key, Options>
|
|
2176
|
-
|
|
2177
|
-
|
|
2149
|
+
// Handle arrays and tuples
|
|
2150
|
+
: BaseType extends readonly unknown[]
|
|
2151
|
+
? Key extends `${number}`
|
|
2152
|
+
// For arrays with unknown length (regular arrays)
|
|
2153
|
+
? number extends BaseType['length']
|
|
2154
|
+
? Strictify<BaseType[number], Options>
|
|
2155
|
+
// For tuples: check if the index is valid
|
|
2156
|
+
: Key extends keyof BaseType
|
|
2157
|
+
? Strictify<BaseType[Key & keyof BaseType], Options>
|
|
2158
|
+
// Out-of-bounds access for tuples
|
|
2159
|
+
: unknown
|
|
2160
|
+
// Non-numeric string key for arrays/tuples
|
|
2161
|
+
: unknown
|
|
2162
|
+
// Handle array-like objects
|
|
2178
2163
|
: BaseType extends {
|
|
2179
2164
|
[n: number]: infer Item;
|
|
2180
2165
|
length: number; // Note: This is needed to avoid being too lax with records types using number keys like `{0: string; 1: boolean}`.
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var L=Object.defineProperty;var o=(c,y)=>L(c,"name",{value:y,configurable:!0});import{default as w}from"./packem_shared/omit-BcaD2qRn.mjs";import{default as B}from"./packem_shared/pick-BxgLK1bH.mjs";import{deleteProperty as W,escapePath as z,getProperty as C,hasProperty as G,setProperty as H}from"./packem_shared/getProperty-D2xQpEOY.mjs";import{default as Q}from"./packem_shared/isPlainObject-CLTs8VdF.mjs";var s={},p={},D;function N(){if(D)return p;D=1;var c=Object.defineProperty,y=o((i,b)=>c(i,"name",{value:b,configurable:!0}),"t");Object.defineProperty(p,"__esModule",{value:!0}),p.isDocumentToRecurOn=p.flatten=p.unique=void 0;function u(i){return[...new Set(i)]}o(u,"unique"),y(u,"unique"),p.unique=u;function f(i){return[].concat(...i)}o(f,"flatten"),y(f,"flatten"),p.flatten=f;function m(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Object.keys(i).length}return o(m,"isDocumentToRecurOn"),y(m,"isDocumentToRecurOn"),p.isDocumentToRecurOn=m,p}o(N,"requireUtils");var K={},P;function R(){return P||(P=1,Object.defineProperty(K,"__esModule",{value:!0})),K}o(R,"requireTypes");var q;function k(){return q||(q=1,function(c){var y=Object.defineProperty,u=o((t,e)=>y(t,"name",{value:e,configurable:!0}),"i"),f=s&&s.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:u(function(){return e[r]},"get")}),Object.defineProperty(t,a,n)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),m=s&&s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=s&&s.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f(e,t,r);return m(e,t),e},b=s&&s.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f(e,t,r)};Object.defineProperty(c,"__esModule",{value:!0}),c.deepKeysFromList=c.deepKeys=void 0;const l=i(N());b(R(),c);function O(t,e){const r=A(e);return typeof t=="object"&&t!==null?v("",t,r):[]}o(O,"deepKeys"),u(O,"deepKeys"),c.deepKeys=O;function g(t,e){const r=A(e);return t.map(a=>typeof a=="object"&&a!==null?O(a,r):[])}o(g,"deepKeysFromList"),u(g,"deepKeysFromList"),c.deepKeysFromList=g;function v(t,e,r){const a=Object.keys(e).map(n=>{const d=j(t,_(n,r));return r.expandNestedObjects&&l.isDocumentToRecurOn(e[n])||r.arrayIndexesAsKeys&&Array.isArray(e[n])&&e[n].length?v(d,e[n],r):r.expandArrayObjects&&Array.isArray(e[n])?h(e[n],d,r):r.ignoreEmptyArrays&&Array.isArray(e[n])&&!e[n].length?[]:d});return l.flatten(a)}o(v,"generateDeepKeysList"),u(v,"generateDeepKeysList");function h(t,e,r){let a=g(t,r);return t.length?t.length&&l.flatten(a).length===0?[e]:(a=a.map(n=>Array.isArray(n)&&n.length===0?[e]:n.map(d=>j(e,_(d,r)))),l.unique(l.flatten(a))):r.ignoreEmptyArraysWhenExpanding?[]:[e]}o(h,"processArrayKeys"),u(h,"processArrayKeys");function _(t,e){return e.escapeNestedDots?t.replace(/\./g,"\\."):t}o(_,"escapeNestedDotsIfSpecified"),u(_,"escapeNestedDotsIfSpecified");function j(t,e){return t?t+"."+e:e}o(j,"buildKeyName"),u(j,"buildKeyName");function A(t){return{arrayIndexesAsKeys:!1,expandNestedObjects:!0,expandArrayObjects:!1,ignoreEmptyArraysWhenExpanding:!1,escapeNestedDots:!1,ignoreEmptyArrays:!1,...t??{}}}o(A,"mergeOptions"),u(A,"mergeOptions")}(s)),s}o(k,"requireDeeks");var x=k();const M=x.deepKeys,S=x.deepKeysFromList;export{M as deepKeys,S as deepKeysFromList,W as deleteProperty,z as escapePath,C as getProperty,G as hasProperty,Q as isPlainObject,w as omit,B as pick,H as setProperty};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var I=Object.defineProperty;var a=(e,r)=>I(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var k=Object.defineProperty,s=a((e,r)=>k(e,"name",{value:r,configurable:!0}),"s");const f=s(e=>{const r=typeof e;return e!==null&&(r==="object"||r==="function")},"isObject"),m=s(e=>f(e)&&Object.keys(e).length===0,"isEmptyObject"),p=new Set(["__proto__","prototype","constructor"]),j=new Set("0123456789");function u(e){const r=[];let n="",t="start",i=!1;for(const o of e)switch(o){case"\\":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");i&&(n+=o),t="property",i=!i;break}case".":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="property";break}if(i){i=!1,n+=o;break}if(p.has(n))return[];r.push(n),n="",t="property";break}case"[":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="index";break}if(i){i=!1,n+=o;break}if(t==="property"){if(p.has(n))return[];r.push(n),n=""}t="index";break}case"]":{if(t==="index"){r.push(Number.parseInt(n,10)),n="",t="indexEnd";break}if(t==="indexEnd")throw new Error("Invalid character after an index")}default:{if(t==="index"&&!j.has(o))throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");t==="start"&&(t="property"),i&&(i=!1,n+="\\"),n+=o}}switch(i&&(n+="\\"),t){case"property":{if(p.has(n))return[];r.push(n);break}case"index":throw new Error("Index was not closed");case"start":{r.push("");break}}return r}a(u,"d");s(u,"getPathSegments");function d(e,r){if(typeof r!="number"&&Array.isArray(e)){const n=Number.parseInt(r,10);return Number.isInteger(n)&&e[n]===e[r]}return!1}a(d,"l");s(d,"isStringIndex");function h(e,r){if(d(e,r))throw new Error("Cannot use string index")}a(h,"p");s(h,"assertNotStringIndex");function b(e,r,n){if(!f(e)||typeof r!="string")return n===void 0?e:n;const t=u(r);if(t.length===0)return n;for(let i=0;i<t.length;i++){const o=t[i];if(d(e,o)?e=i===t.length-1?void 0:null:e=e[o],e==null){if(i!==t.length-1)return n;break}}return e===void 0?n:e}a(b,"getProperty");s(b,"getProperty");function x(e,r,n){if(!f(e)||typeof r!="string")return e;const t=e,i=u(r);for(let o=0;o<i.length;o++){const c=i[o];h(e,c),o===i.length-1?e[c]=n:f(e[c])||(e[c]=typeof i[o+1]=="number"?[]:{}),e=e[c]}return t}a(x,"setProperty");s(x,"setProperty");function w(e,r){if(!f(e)||typeof r!="string")return!1;const n=u(r);for(let t=0;t<n.length;t++){const i=n[t];if(h(e,i),t===n.length-1)return delete e[i],!0;if(e=e[i],!f(e))return!1}}a(w,"deleteProperty");s(w,"deleteProperty");function P(e,r){if(!f(e)||typeof r!="string")return!1;const n=u(r);if(n.length===0)return!1;for(const t of n){if(!f(e)||!(t in e)||d(e,t))return!1;e=e[t]}return!0}a(P,"hasProperty");s(P,"hasProperty");function l(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}a(l,"escapePath");s(l,"escapePath");function y(e){const r=Object.entries(e);return Array.isArray(e)?r.map(([n,t])=>[Number(n),t]):r}a(y,"h");s(y,"entries");function E(e){let r="";for(let[n,t]of y(e))typeof t=="number"?r+=`[${t}]`:(t=l(t),r+=n===0?t:`.${t}`);return r}a(E,"w");s(E,"stringifyPath");function*g(e,r=[]){if(!f(e)||m(e)){r.length>0&&(yield E(r));return}for(const[n,t]of y(e))yield*g(t,[...r,n])}a(g,"y");s(g,"deepKeysIterator");function v(e){return[...g(e)]}a(v,"deepKeys");s(v,"deepKeys");exports.deepKeys=v;exports.deleteProperty=w;exports.escapePath=l;exports.getProperty=b;exports.hasProperty=P;exports.setProperty=x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var w=Object.defineProperty;var a=(e,r)=>w(e,"name",{value:r,configurable:!0});var b=Object.defineProperty,f=a((e,r)=>b(e,"name",{value:r,configurable:!0}),"s");const s=f(e=>{const r=typeof e;return e!==null&&(r==="object"||r==="function")},"isObject"),E=f(e=>s(e)&&Object.keys(e).length===0,"isEmptyObject"),p=new Set(["__proto__","prototype","constructor"]),I=new Set("0123456789");function u(e){const r=[];let n="",t="start",i=!1;for(const o of e)switch(o){case"\\":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");i&&(n+=o),t="property",i=!i;break}case".":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="property";break}if(i){i=!1,n+=o;break}if(p.has(n))return[];r.push(n),n="",t="property";break}case"[":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="index";break}if(i){i=!1,n+=o;break}if(t==="property"){if(p.has(n))return[];r.push(n),n=""}t="index";break}case"]":{if(t==="index"){r.push(Number.parseInt(n,10)),n="",t="indexEnd";break}if(t==="indexEnd")throw new Error("Invalid character after an index")}default:{if(t==="index"&&!I.has(o))throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");t==="start"&&(t="property"),i&&(i=!1,n+="\\"),n+=o}}switch(i&&(n+="\\"),t){case"property":{if(p.has(n))return[];r.push(n);break}case"index":throw new Error("Index was not closed");case"start":{r.push("");break}}return r}a(u,"d");f(u,"getPathSegments");function d(e,r){if(typeof r!="number"&&Array.isArray(e)){const n=Number.parseInt(r,10);return Number.isInteger(n)&&e[n]===e[r]}return!1}a(d,"l");f(d,"isStringIndex");function h(e,r){if(d(e,r))throw new Error("Cannot use string index")}a(h,"p");f(h,"assertNotStringIndex");function v(e,r,n){if(!s(e)||typeof r!="string")return n===void 0?e:n;const t=u(r);if(t.length===0)return n;for(let i=0;i<t.length;i++){const o=t[i];if(d(e,o)?e=i===t.length-1?void 0:null:e=e[o],e==null){if(i!==t.length-1)return n;break}}return e===void 0?n:e}a(v,"getProperty");f(v,"getProperty");function P(e,r,n){if(!s(e)||typeof r!="string")return e;const t=e,i=u(r);for(let o=0;o<i.length;o++){const c=i[o];h(e,c),o===i.length-1?e[c]=n:s(e[c])||(e[c]=typeof i[o+1]=="number"?[]:{}),e=e[c]}return t}a(P,"setProperty");f(P,"setProperty");function k(e,r){if(!s(e)||typeof r!="string")return!1;const n=u(r);for(let t=0;t<n.length;t++){const i=n[t];if(h(e,i),t===n.length-1)return delete e[i],!0;if(e=e[i],!s(e))return!1}}a(k,"deleteProperty");f(k,"deleteProperty");function m(e,r){if(!s(e)||typeof r!="string")return!1;const n=u(r);if(n.length===0)return!1;for(const t of n){if(!s(e)||!(t in e)||d(e,t))return!1;e=e[t]}return!0}a(m,"hasProperty");f(m,"hasProperty");function g(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}a(g,"escapePath");f(g,"escapePath");function l(e){const r=Object.entries(e);return Array.isArray(e)?r.map(([n,t])=>[Number(n),t]):r}a(l,"h");f(l,"entries");function x(e){let r="";for(let[n,t]of l(e))typeof t=="number"?r+=`[${t}]`:(t=g(t),r+=n===0?t:`.${t}`);return r}a(x,"w");f(x,"stringifyPath");function*y(e,r=[]){if(!s(e)||E(e)){r.length>0&&(yield x(r));return}for(const[n,t]of l(e))yield*y(t,[...r,n])}a(y,"y");f(y,"deepKeysIterator");function j(e){return[...y(e)]}a(j,"deepKeys");f(j,"deepKeys");export{j as deepKeys,k as deleteProperty,g as escapePath,v as getProperty,m as hasProperty,P as setProperty};
|
|
@@ -0,0 +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}),"e");function a(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)}o(a,"r");l(a,"isPlainObject");export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var o=(e,t)=>n(e,"name",{value:t,configurable:!0});var i=Object.defineProperty,l=o((e,t)=>i(e,"name",{value:t,configurable:!0}),"e");function r(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)}o(r,"r");l(r,"isPlainObject");module.exports=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var v=Object.defineProperty;var t=(r,e)=>v(r,"name",{value:e,configurable:!0});const u=require("./isPlainObject-Ct8-08mJ.cjs"),b=require("./paths-are-equal-D8teV-Y-.cjs");var f=Object.defineProperty,y=t((r,e)=>f(r,"name",{value:e,configurable:!0}),"m$1");const s=y((r,e,o="")=>u(r)?Object.entries(r).reduce((a,[n,c])=>{let i=o;return i&&(i+="."),i+=n,e.some(m=>b.c(i,m))?a:u(c)?(a[n]=s(r[n],e,i),a):(a[n]=c,a)},{}):r,"recursiveOmit");var O=Object.defineProperty,l=t((r,e)=>O(r,"name",{value:e,configurable:!0}),"r");const j=l(r=>Array.isArray(r)&&r.length>0,"isFullArray"),p=l((r,e)=>j(e)?s(r,e):r,"omit");module.exports=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var v=Object.defineProperty;var n=(r,e)=>v(r,"name",{value:e,configurable:!0});import m from"./isPlainObject-CLTs8VdF.mjs";import{c as s}from"./paths-are-equal-BgwMgI_D.mjs";var b=Object.defineProperty,p=n((r,e)=>b(r,"name",{value:e,configurable:!0}),"m$1");const c=p((r,e,u="")=>m(r)?Object.entries(r).reduce((a,[i,t])=>{let o=u;return o&&(o+="."),o+=i,e.some(f=>s(o,f))?a:m(t)?(a[i]=c(r[i],e,o),a):(a[i]=t,a)},{}):r,"recursiveOmit");var y=Object.defineProperty,l=n((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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=Object.defineProperty;var a=(e,r)=>b(e,"name",{value:r,configurable:!0});import s from"./isPlainObject-CLTs8VdF.mjs";import{c as d}from"./paths-are-equal-BgwMgI_D.mjs";var j=Object.defineProperty,y=a((e,r)=>j(e,"name",{value:r,configurable:!0}),"h");const p=y((e,r,f="")=>s(e)?Object.entries(e).reduce((i,[l,c])=>{let t=f;if(t&&(t+="."),t+=l,r.length>0){let n=!1;if(r.forEach(o=>{const v=t.split(".").length,g=o.split(".").length,h=o.split(".").slice(0,v).join("."),m=t.split(".").slice(0,g).join(".");d(m,h)&&(n=!0)}),!n)return i}return s(c)?(i[l]=p(e[l],r,t),i):(i[l]=c,i)},{}):e,"recursivePick");var P=Object.defineProperty,u=a((e,r)=>P(e,"name",{value:r,configurable:!0}),"t");const A=u(e=>Array.isArray(e)&&e.length>0,"isFullArray"),E=u((e,r)=>A(r)?p(e,r):{},"pick");export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var j=Object.defineProperty;var l=(e,r)=>j(e,"name",{value:r,configurable:!0});const u=require("./isPlainObject-
|
|
1
|
+
"use strict";var j=Object.defineProperty;var l=(e,r)=>j(e,"name",{value:r,configurable:!0});const u=require("./isPlainObject-Ct8-08mJ.cjs"),y=require("./paths-are-equal-D8teV-Y-.cjs");var P=Object.defineProperty,d=l((e,r)=>P(e,"name",{value:r,configurable:!0}),"h");const o=d((e,r,f="")=>u(e)?Object.entries(e).reduce((i,[c,a])=>{let t=f;if(t&&(t+="."),t+=c,r.length>0){let n=!1;if(r.forEach(s=>{const h=t.split(".").length,v=s.split(".").length,b=s.split(".").slice(0,h).join("."),g=t.split(".").slice(0,v).join(".");y.c(g,b)&&(n=!0)}),!n)return i}return u(a)?(i[c]=o(e[c],r,t),i):(i[c]=a,i)},{}):e,"recursivePick");var A=Object.defineProperty,p=l((e,r)=>A(e,"name",{value:r,configurable:!0}),"t");const O=p(e=>Array.isArray(e)&&e.length>0,"isFullArray"),q=p((e,r)=>O(r)?o(e,r):{},"pick");module.exports=q;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/object",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Helper functions for working with objects and arrays.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
"@anolilab/eslint-config": "^15.0.3",
|
|
81
81
|
"@anolilab/prettier-config": "^5.0.14",
|
|
82
82
|
"@anolilab/semantic-release-pnpm": "1.1.3",
|
|
83
|
-
"@anolilab/semantic-release-preset": "^9.0.
|
|
84
|
-
"@arethetypeswrong/cli": "^0.
|
|
85
|
-
"@babel/core": "^7.
|
|
83
|
+
"@anolilab/semantic-release-preset": "^9.0.2",
|
|
84
|
+
"@arethetypeswrong/cli": "^0.17.1",
|
|
85
|
+
"@babel/core": "^7.26.0",
|
|
86
86
|
"@rushstack/eslint-plugin-security": "^0.8.3",
|
|
87
|
-
"@secretlint/secretlint-rule-preset-recommend": "^
|
|
87
|
+
"@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
|
|
88
88
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
89
89
|
"@types/node": "18.19.39",
|
|
90
|
-
"@visulima/packem": "1.
|
|
91
|
-
"@vitest/coverage-v8": "^2.1.
|
|
92
|
-
"@vitest/ui": "^2.1.
|
|
90
|
+
"@visulima/packem": "^1.9.2",
|
|
91
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
92
|
+
"@vitest/ui": "^2.1.8",
|
|
93
93
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
94
94
|
"cross-env": "^7.0.3",
|
|
95
95
|
"deeks": "^3.1.1",
|
|
@@ -104,16 +104,16 @@
|
|
|
104
104
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
105
105
|
"filter-obj": "^6.1.0",
|
|
106
106
|
"is-plain-obj": "^4.1.0",
|
|
107
|
-
"prettier": "^3.
|
|
107
|
+
"prettier": "^3.4.2",
|
|
108
108
|
"rimraf": "5.0.9",
|
|
109
109
|
"secretlint": "8.2.4",
|
|
110
|
-
"semantic-release": "^24.
|
|
111
|
-
"type-fest": "^4.
|
|
110
|
+
"semantic-release": "^24.2.0",
|
|
111
|
+
"type-fest": "^4.30.0",
|
|
112
112
|
"typescript": "5.5.4",
|
|
113
|
-
"vitest": "^2.1.
|
|
113
|
+
"vitest": "^2.1.8"
|
|
114
114
|
},
|
|
115
115
|
"engines": {
|
|
116
|
-
"node": ">=18.* <=
|
|
116
|
+
"node": ">=18.* <=23.*"
|
|
117
117
|
},
|
|
118
118
|
"publishConfig": {
|
|
119
119
|
"access": "public",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=Object.defineProperty;var s=(r,n)=>c(r,"name",{value:n,configurable:!0});const a=s(r=>{const n=typeof r;return r!==null&&(n==="object"||n==="function")},"isObject"),x=s(r=>a(r)&&Object.keys(r).length===0,"isEmptyObject"),u=new Set(["__proto__","prototype","constructor"]),g=new Set("0123456789");function d(r){const n=[];let t="",e="start",i=!1;for(const f of r)switch(f){case"\\":{if(e==="index")throw new Error("Invalid character in an index");if(e==="indexEnd")throw new Error("Invalid character after an index");i&&(t+=f),e="property",i=!i;break}case".":{if(e==="index")throw new Error("Invalid character in an index");if(e==="indexEnd"){e="property";break}if(i){i=!1,t+=f;break}if(u.has(t))return[];n.push(t),t="",e="property";break}case"[":{if(e==="index")throw new Error("Invalid character in an index");if(e==="indexEnd"){e="index";break}if(i){i=!1,t+=f;break}if(e==="property"){if(u.has(t))return[];n.push(t),t=""}e="index";break}case"]":{if(e==="index"){n.push(Number.parseInt(t,10)),t="",e="indexEnd";break}if(e==="indexEnd")throw new Error("Invalid character after an index")}default:{if(e==="index"&&!g.has(f))throw new Error("Invalid character in an index");if(e==="indexEnd")throw new Error("Invalid character after an index");e==="start"&&(e="property"),i&&(i=!1,t+="\\"),t+=f}}switch(i&&(t+="\\"),e){case"property":{if(u.has(t))return[];n.push(t);break}case"index":throw new Error("Index was not closed");case"start":{n.push("");break}}return n}s(d,"getPathSegments");function l(r,n){if(typeof n!="number"&&Array.isArray(r)){const t=Number.parseInt(n,10);return Number.isInteger(t)&&r[t]===r[n]}return!1}s(l,"isStringIndex");function p(r,n){if(l(r,n))throw new Error("Cannot use string index")}s(p,"assertNotStringIndex");function I(r,n,t){if(!a(r)||typeof n!="string")return t===void 0?r:t;const e=d(n);if(e.length===0)return t;for(let i=0;i<e.length;i++){const f=e[i];if(l(r,f)?r=i===e.length-1?void 0:null:r=r[f],r==null){if(i!==e.length-1)return t;break}}return r===void 0?t:r}s(I,"getProperty");function m(r,n,t){if(!a(r)||typeof n!="string")return r;const e=r,i=d(n);for(let f=0;f<i.length;f++){const o=i[f];p(r,o),f===i.length-1?r[o]=t:a(r[o])||(r[o]=typeof i[f+1]=="number"?[]:{}),r=r[o]}return e}s(m,"setProperty");function A(r,n){if(!a(r)||typeof n!="string")return!1;const t=d(n);for(let e=0;e<t.length;e++){const i=t[e];if(p(r,i),e===t.length-1)return delete r[i],!0;if(r=r[i],!a(r))return!1}}s(A,"deleteProperty");function P(r,n){if(!a(r)||typeof n!="string")return!1;const t=d(n);if(t.length===0)return!1;for(const e of t){if(!a(r)||!(e in r)||l(r,e))return!1;r=r[e]}return!0}s(P,"hasProperty");function w(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replaceAll(/[\\.[]/g,"\\$&")}s(w,"escapePath");function h(r){const n=Object.entries(r);return Array.isArray(r)?n.map(([t,e])=>[Number(t),e]):n}s(h,"entries");function E(r){let n="";for(let[t,e]of h(r))typeof e=="number"?n+=`[${e}]`:(e=w(e),n+=t===0?e:`.${e}`);return n}s(E,"stringifyPath");function*y(r,n=[]){if(!a(r)||x(r)){n.length>0&&(yield E(n));return}for(const[t,e]of h(r))yield*y(e,[...n,t])}s(y,"deepKeysIterator");function S(r){return[...y(r)]}s(S,"deepKeys");export{S as deepKeys,A as deleteProperty,w as escapePath,I as getProperty,P as hasProperty,m as setProperty};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var f=(r,n)=>g(r,"name",{value:n,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=f(r=>{const n=typeof r;return r!==null&&(n==="object"||n==="function")},"isObject"),x=f(r=>a(r)&&Object.keys(r).length===0,"isEmptyObject"),u=new Set(["__proto__","prototype","constructor"]),w=new Set("0123456789");function d(r){const n=[];let t="",e="start",i=!1;for(const s of r)switch(s){case"\\":{if(e==="index")throw new Error("Invalid character in an index");if(e==="indexEnd")throw new Error("Invalid character after an index");i&&(t+=s),e="property",i=!i;break}case".":{if(e==="index")throw new Error("Invalid character in an index");if(e==="indexEnd"){e="property";break}if(i){i=!1,t+=s;break}if(u.has(t))return[];n.push(t),t="",e="property";break}case"[":{if(e==="index")throw new Error("Invalid character in an index");if(e==="indexEnd"){e="index";break}if(i){i=!1,t+=s;break}if(e==="property"){if(u.has(t))return[];n.push(t),t=""}e="index";break}case"]":{if(e==="index"){n.push(Number.parseInt(t,10)),t="",e="indexEnd";break}if(e==="indexEnd")throw new Error("Invalid character after an index")}default:{if(e==="index"&&!w.has(s))throw new Error("Invalid character in an index");if(e==="indexEnd")throw new Error("Invalid character after an index");e==="start"&&(e="property"),i&&(i=!1,t+="\\"),t+=s}}switch(i&&(t+="\\"),e){case"property":{if(u.has(t))return[];n.push(t);break}case"index":throw new Error("Index was not closed");case"start":{n.push("");break}}return n}f(d,"getPathSegments");function l(r,n){if(typeof n!="number"&&Array.isArray(r)){const t=Number.parseInt(n,10);return Number.isInteger(t)&&r[t]===r[n]}return!1}f(l,"isStringIndex");function p(r,n){if(l(r,n))throw new Error("Cannot use string index")}f(p,"assertNotStringIndex");function E(r,n,t){if(!a(r)||typeof n!="string")return t===void 0?r:t;const e=d(n);if(e.length===0)return t;for(let i=0;i<e.length;i++){const s=e[i];if(l(r,s)?r=i===e.length-1?void 0:null:r=r[s],r==null){if(i!==e.length-1)return t;break}}return r===void 0?t:r}f(E,"getProperty");function k(r,n,t){if(!a(r)||typeof n!="string")return r;const e=r,i=d(n);for(let s=0;s<i.length;s++){const o=i[s];p(r,o),s===i.length-1?r[o]=t:a(r[o])||(r[o]=typeof i[s+1]=="number"?[]:{}),r=r[o]}return e}f(k,"setProperty");function I(r,n){if(!a(r)||typeof n!="string")return!1;const t=d(n);for(let e=0;e<t.length;e++){const i=t[e];if(p(r,i),e===t.length-1)return delete r[i],!0;if(r=r[i],!a(r))return!1}}f(I,"deleteProperty");function m(r,n){if(!a(r)||typeof n!="string")return!1;const t=d(n);if(t.length===0)return!1;for(const e of t){if(!a(r)||!(e in r)||l(r,e))return!1;r=r[e]}return!0}f(m,"hasProperty");function y(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replaceAll(/[\\.[]/g,"\\$&")}f(y,"escapePath");function h(r){const n=Object.entries(r);return Array.isArray(r)?n.map(([t,e])=>[Number(t),e]):n}f(h,"entries");function P(r){let n="";for(let[t,e]of h(r))typeof e=="number"?n+=`[${e}]`:(e=y(e),n+=t===0?e:`.${e}`);return n}f(P,"stringifyPath");function*c(r,n=[]){if(!a(r)||x(r)){n.length>0&&(yield P(n));return}for(const[t,e]of h(r))yield*c(e,[...n,t])}f(c,"deepKeysIterator");function A(r){return[...c(r)]}f(A,"deepKeys");exports.deepKeys=A;exports.deleteProperty=I;exports.escapePath=y;exports.getProperty=E;exports.hasProperty=m;exports.setProperty=k;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var e=(t,o)=>r(t,"name",{value:o,configurable:!0});function n(t){if(typeof t!="object"||t===null)return!1;const o=Object.getPrototypeOf(t);return(o===null||o===Object.prototype||Object.getPrototypeOf(o)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}e(n,"isPlainObject");module.exports=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty;var e=(t,o)=>n(t,"name",{value:o,configurable:!0});function i(t){if(typeof t!="object"||t===null)return!1;const o=Object.getPrototypeOf(t);return(o===null||o===Object.prototype||Object.getPrototypeOf(o)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}e(i,"isPlainObject");export{i as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var t=(r,e)=>v(r,"name",{value:e,configurable:!0});const s=require("./isPlainObject-BTLAczOE.cjs"),b=require("./paths-are-equal-D8teV-Y-.cjs");var f=Object.defineProperty,y=t((r,e)=>f(r,"name",{value:e,configurable:!0}),"m$1");const u=y((r,e,l="")=>s(r)?Object.entries(r).reduce((a,[n,c])=>{let i=l;return i&&(i+="."),i+=n,e.some(m=>b.c(i,m))?a:s(c)?(a[n]=u(r[n],e,i),a):(a[n]=c,a)},{}):r,"recursiveOmit");var O=Object.defineProperty,o=t((r,e)=>O(r,"name",{value:e,configurable:!0}),"r");const j=o(r=>Array.isArray(r)&&r.length>0,"isFullArray"),p=o((r,e)=>j(e)?u(r,e):r,"omit");module.exports=p;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var o=(r,e)=>s(r,"name",{value:e,configurable:!0});import c from"./isPlainObject-CFPUbgRS.mjs";import{c as v}from"./paths-are-equal-BgwMgI_D.mjs";var b=Object.defineProperty,p=o((r,e)=>b(r,"name",{value:e,configurable:!0}),"m$1");const m=p((r,e,u="")=>c(r)?Object.entries(r).reduce((a,[n,t])=>{let i=u;return i&&(i+="."),i+=n,e.some(f=>v(i,f))?a:c(t)?(a[n]=m(r[n],e,i),a):(a[n]=t,a)},{}):r,"recursiveOmit");var y=Object.defineProperty,l=o((r,e)=>y(r,"name",{value:e,configurable:!0}),"r");const O=l(r=>Array.isArray(r)&&r.length>0,"isFullArray"),A=l((r,e)=>O(e)?m(r,e):r,"omit");export{A as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=Object.defineProperty;var a=(e,r)=>j(e,"name",{value:r,configurable:!0});import s from"./isPlainObject-CFPUbgRS.mjs";import{c as m}from"./paths-are-equal-BgwMgI_D.mjs";var d=Object.defineProperty,y=a((e,r)=>d(e,"name",{value:r,configurable:!0}),"h");const p=y((e,r,f="")=>s(e)?Object.entries(e).reduce((i,[l,c])=>{let t=f;if(t&&(t+="."),t+=l,r.length>0){let n=!1;if(r.forEach(o=>{const v=t.split(".").length,b=o.split(".").length,g=o.split(".").slice(0,v).join("."),h=t.split(".").slice(0,b).join(".");m(h,g)&&(n=!0)}),!n)return i}return s(c)?(i[l]=p(e[l],r,t),i):(i[l]=c,i)},{}):e,"recursivePick");var P=Object.defineProperty,u=a((e,r)=>P(e,"name",{value:r,configurable:!0}),"t");const O=u(e=>Array.isArray(e)&&e.length>0,"isFullArray"),x=u((e,r)=>O(r)?p(e,r):{},"pick");export{x as default};
|