@homer0/object-utils 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +11 -11
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -235,9 +235,9 @@ There are also a few "shorthand implementations" of `formatKeys`:
|
|
|
235
235
|
|
|
236
236
|
### 🤘 Development
|
|
237
237
|
|
|
238
|
-
As this project is part of the `packages` monorepo,
|
|
238
|
+
As this project is part of the `packages` monorepo, some of the tooling, like ESLint and Husky, are installed on the root's `package.json`.
|
|
239
239
|
|
|
240
|
-
####
|
|
240
|
+
#### NPM tasks
|
|
241
241
|
|
|
242
242
|
| Task | Description |
|
|
243
243
|
| ------- | -------------------- |
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ declare const copy: <T>(target: T) => T;
|
|
|
13
13
|
* @param substring The captured string to replace.
|
|
14
14
|
* @param args The list of groups captured by the expression.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
type FormatKeysReplaceFn = (substring: string, ...args: string[]) => string;
|
|
17
|
+
type FormatKeysOptions = {
|
|
18
18
|
/**
|
|
19
19
|
* The object to transform.
|
|
20
20
|
*/
|
|
@@ -42,7 +42,7 @@ declare type FormatKeysOptions = {
|
|
|
42
42
|
*/
|
|
43
43
|
pathDelimiter?: string;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
type FormatKeysExtensionOptions = Omit<FormatKeysOptions, 'search' | 'replace'>;
|
|
46
46
|
/**
|
|
47
47
|
* Formats all the keys on an object using a way similar to `.replace(regexp, ...)` but
|
|
48
48
|
* that also works recursively and with _"object paths"_.
|
|
@@ -93,8 +93,8 @@ declare const dashToSnakeKeys: <T>(options: FormatKeysExtensionOptions) => T;
|
|
|
93
93
|
* Used in the {@link extract} function to specify a path for a property, or an "origin path"
|
|
94
94
|
* and an "extraction path".
|
|
95
95
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
type extractionPath = string | Record<string, string>;
|
|
97
|
+
type ExtractOptions = {
|
|
98
98
|
/**
|
|
99
99
|
* The object from where the property/properties will be extracted.
|
|
100
100
|
*/
|
|
@@ -149,8 +149,8 @@ declare const extract: <T = Record<string, unknown>>(options: ExtractOptions) =>
|
|
|
149
149
|
* @param key The key to check inside its parent.
|
|
150
150
|
* @param value The value of the key.
|
|
151
151
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
type ShouldFlattenFn = (key: string, value: unknown) => boolean;
|
|
153
|
+
type FlatOptions = {
|
|
154
154
|
/**
|
|
155
155
|
* The object to transform.
|
|
156
156
|
*/
|
|
@@ -190,7 +190,7 @@ declare type FlatOptions = {
|
|
|
190
190
|
*/
|
|
191
191
|
declare const flat: <T = Record<string, unknown>>(options: FlatOptions) => T;
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
type GetOptions = {
|
|
194
194
|
/**
|
|
195
195
|
* The object from where the property will be read.
|
|
196
196
|
*/
|
|
@@ -272,7 +272,7 @@ declare const lowerCamelToSnakeKeys: <T>(options: FormatKeysExtensionOptions) =>
|
|
|
272
272
|
*/
|
|
273
273
|
declare const merge: <T = unknown>(...targets: unknown[]) => T;
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
type RemoveOptions = {
|
|
276
276
|
/**
|
|
277
277
|
* The object from where the property will be removed.
|
|
278
278
|
*/
|
|
@@ -316,7 +316,7 @@ declare type RemoveOptions = {
|
|
|
316
316
|
declare function remove<T = unknown>(options: RemoveOptions): T | undefined;
|
|
317
317
|
declare function remove<T = unknown>(options: unknown, path: string): T | undefined;
|
|
318
318
|
|
|
319
|
-
|
|
319
|
+
type SetOptions = {
|
|
320
320
|
/**
|
|
321
321
|
* The object where the property will be set.
|
|
322
322
|
*/
|
|
@@ -375,7 +375,7 @@ declare const snakeToDashKeys: <T>(options: FormatKeysExtensionOptions) => T;
|
|
|
375
375
|
*/
|
|
376
376
|
declare const snakeToLowerCamelKeys: <T>(options: FormatKeysExtensionOptions) => T;
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
type UnflatOptions = {
|
|
379
379
|
/**
|
|
380
380
|
* The object to transform.
|
|
381
381
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homer0/object-utils",
|
|
3
3
|
"description": "A small collection of utility methods to work with objects.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/homer0/packages.git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/extend": "^3.0.1",
|
|
30
|
-
"jest": "^29.
|
|
30
|
+
"jest": "^29.3.1",
|
|
31
31
|
"ts-jest": "^29.0.3",
|
|
32
|
-
"tsup": "^6.
|
|
33
|
-
"typescript": "^4.
|
|
32
|
+
"tsup": "^6.5.0",
|
|
33
|
+
"typescript": "^4.9.4"
|
|
34
34
|
},
|
|
35
35
|
"engine-strict": true,
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">=16"
|
|
38
38
|
},
|
|
39
39
|
"main": "./dist/index.js",
|
|
40
40
|
"module": "./dist/esm/index.js",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"build": "tsup src/index.ts",
|
|
47
47
|
"prepublishOnly": "npm run build"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "86d8723fd11c969e334d58c4e6bc4d290311fe26"
|
|
50
50
|
}
|