assign-gingerly 0.0.3 → 0.0.4
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 +5 -3
- package/index.js +3 -0
- package/package.json +13 -4
- package/types.d.ts +35 -0
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
# assign-gingerly
|
|
1
|
+
# assign-gingerly and assign-tentatively
|
|
2
2
|
|
|
3
3
|
[](https://github.com/bahrus/assign-gingerly/actions/workflows/CI.yml)
|
|
4
4
|
[](http://badge.fury.io/js/assign-gingerly)
|
|
5
5
|
[](https://bundlephobia.com/result?p=assign-gingerly)
|
|
6
6
|
<img src="http://img.badgesize.io/https://cdn.jsdelivr.net/npm/assign-gingerly?compression=gzip">
|
|
7
7
|
|
|
8
|
-
This package provides
|
|
8
|
+
This package provides two utility functions for carefully merging one object into another.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## assignGingerly
|
|
11
|
+
|
|
12
|
+
assignGingerly builds on Object.assign. assign-gingerly adds support for:
|
|
11
13
|
|
|
12
14
|
1. Carefully merging in nested properties.
|
|
13
15
|
2. Dependency injection based on a mapping protocol.
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assign-gingerly",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "This package provides a utility function for carefully merging one object into another.",
|
|
5
5
|
"homepage": "https://github.com/bahrus/assign-gingerly#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -16,17 +16,26 @@
|
|
|
16
16
|
"types": "types.d.ts",
|
|
17
17
|
"files": [
|
|
18
18
|
"assignGingerly.js",
|
|
19
|
-
"
|
|
19
|
+
"types.d.ts",
|
|
20
20
|
"README.md",
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"
|
|
25
|
+
"default": "./index.js",
|
|
26
|
+
"types": "./types.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./assignGingerly.js": {
|
|
29
|
+
"default": "./assignGingerly.js",
|
|
30
|
+
"types": "./types.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./assignTentatively.js": {
|
|
33
|
+
"default": "./assignTentatively.js",
|
|
26
34
|
"types": "./types.d.ts"
|
|
27
35
|
}
|
|
28
36
|
},
|
|
29
|
-
"main": "
|
|
37
|
+
"main": "index.js",
|
|
38
|
+
"module": "index.js",
|
|
30
39
|
"scripts": {
|
|
31
40
|
"serve": "node ./node_modules/spa-ssi/serve.js",
|
|
32
41
|
"test": "playwright test",
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for registry items that define dependency injection mappings
|
|
3
|
+
*/
|
|
4
|
+
export interface IBaseRegistryItem<T = any> {
|
|
5
|
+
spawn: { new (): T } | Promise<{ new (): T }>;
|
|
6
|
+
map: { [key: string | symbol]: keyof T };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Interface for the options passed to assignGingerly
|
|
11
|
+
*/
|
|
12
|
+
export interface IAssignGingerlyOptions {
|
|
13
|
+
registry?: typeof BaseRegistry | BaseRegistry;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Base registry class for managing dependency injection
|
|
18
|
+
*/
|
|
19
|
+
export declare class BaseRegistry {
|
|
20
|
+
private items;
|
|
21
|
+
push(items: IBaseRegistryItem | IBaseRegistryItem[]): void;
|
|
22
|
+
getItems(): IBaseRegistryItem[];
|
|
23
|
+
findBySymbol(symbol: symbol | string): IBaseRegistryItem | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Main assignGingerly function
|
|
28
|
+
*/
|
|
29
|
+
export declare function assignGingerly(
|
|
30
|
+
target: any,
|
|
31
|
+
source: Record<string | symbol, any>,
|
|
32
|
+
options?: IAssignGingerlyOptions
|
|
33
|
+
): any;
|
|
34
|
+
|
|
35
|
+
export default assignGingerly;
|