@ptolemy2002/list-object-utils 2.0.0 → 2.0.1
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 +4 -4
- package/dist/index.d.ts +2 -1
- package/package.json +11 -6
package/README.md
CHANGED
|
@@ -119,18 +119,18 @@ Finds the difference between two objects, that is, the properties that do not ma
|
|
|
119
119
|
#### Returns
|
|
120
120
|
`ObjectOptional` - If the operands are both objects, an object with a property for every key at which the two objects differ. The value for each property is the value from the second object. If the operands are not both objects and equal, an empty object. If the operands are not both objects and not equal, the second operand.
|
|
121
121
|
|
|
122
|
-
### flattenKeys
|
|
122
|
+
### flattenKeys<T>
|
|
123
123
|
#### Description
|
|
124
124
|
For an object that contains properties that are also objects, this function will flatten the keys of the object to a single level. The keys will be concatenated with a period (`.`) between them. Also does this with lists. Uses recursion to flatten nested objects.
|
|
125
125
|
|
|
126
126
|
Note that empty lists and empty objects are left as-is.
|
|
127
127
|
|
|
128
128
|
#### Parameters
|
|
129
|
-
- `obj` (`
|
|
129
|
+
- `obj` (`T`): The object to be flattened.
|
|
130
130
|
- `prefix` (`string`): The prefix to be added to the keys. Default is an empty string.
|
|
131
131
|
|
|
132
132
|
#### Returns
|
|
133
|
-
`
|
|
133
|
+
`Record<string, ValueOf<T>>` - The object with the keys flattened.
|
|
134
134
|
|
|
135
135
|
### sortWithIndices<T>
|
|
136
136
|
#### Description
|
|
@@ -155,7 +155,7 @@ A simple implementation of `JSON.stringify` that converts undefined values to `n
|
|
|
155
155
|
`string` - The string representation of the object.
|
|
156
156
|
|
|
157
157
|
## Peer Dependencies
|
|
158
|
-
|
|
158
|
+
- @ptolemy2002/ts-utils^1.2.0
|
|
159
159
|
|
|
160
160
|
## Commands
|
|
161
161
|
The following commands exist in the project:
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValueOf } from "@ptolemy2002/ts-utils";
|
|
1
2
|
type ArrayOptional = any[] | null | undefined;
|
|
2
3
|
type ObjectOptional = Object | null | undefined;
|
|
3
4
|
export declare function listsEqual(a: ArrayOptional, b: ArrayOptional): boolean;
|
|
@@ -9,7 +10,7 @@ export declare function listSet<T>(list: T[], i: number, item: T): T[];
|
|
|
9
10
|
export declare function isSet(list: any[]): boolean;
|
|
10
11
|
export declare function listDifference(a: ArrayOptional, b: ArrayOptional): ObjectOptional;
|
|
11
12
|
export declare function objectDifference(a: ObjectOptional, b: ObjectOptional): ObjectOptional;
|
|
12
|
-
export declare function flattenKeys(obj:
|
|
13
|
+
export declare function flattenKeys<T>(obj: T, prefix?: string): Record<string, ValueOf<T>>;
|
|
13
14
|
type SortCallback = (a: number, b: number) => number;
|
|
14
15
|
export declare function sortWithIndeces<T>(toSort: T[], sort?: SortCallback, descending?: boolean): T[];
|
|
15
16
|
export declare function objectToString(obj: Object): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptolemy2002/list-object-utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"/dist"
|
|
9
9
|
],
|
|
10
10
|
"repository": {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/Ptolemy2002/list-object-utils",
|
|
13
|
+
"directory": "lib"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc --project ./tsconfig.json",
|
|
@@ -26,5 +26,10 @@
|
|
|
26
26
|
"release-minor": "bash ./scripts/release.sh minor",
|
|
27
27
|
"release-major": "bash ./scripts/release.sh major"
|
|
28
28
|
},
|
|
29
|
-
"
|
|
30
|
-
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@ptolemy2002/ts-utils": "^1.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@ptolemy2002/ts-utils": "^1.2.0"
|
|
34
|
+
}
|
|
35
|
+
}
|