Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit fd935ef

Browse files
committed
First checkin.
1 parent dc36167 commit fd935ef

File tree

8 files changed

+7272
-0
lines changed

8 files changed

+7272
-0
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_size = 2
9+
indent_style = space
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[*.md]
15+
max_line_length = 0
16+
trim_trailing_whitespace = false
17+
18+
[COMMIT_EDITMSG]
19+
max_line_length = 0

.eslintrc.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5,
4+
"sourceType": "module",
5+
"ecmaFeatures": {
6+
"globalReturn": true
7+
}
8+
},
9+
"rules": {
10+
"constructor-super": 2,
11+
"no-case-declarations": 2,
12+
"no-class-assign": 2,
13+
"no-compare-neg-zero": 2,
14+
"no-cond-assign": 2,
15+
"no-console": 0,
16+
"no-const-assign": 2,
17+
"no-constant-condition": 2,
18+
"no-control-regex": 2,
19+
"no-debugger": 2,
20+
"no-delete-var": 2,
21+
"no-dupe-args": 2,
22+
"no-dupe-class-members": 2,
23+
"no-dupe-keys": 2,
24+
"no-duplicate-case": 2,
25+
"no-empty-character-class": 2,
26+
"no-empty-pattern": 2,
27+
"no-empty": 0,
28+
"no-ex-assign": 2,
29+
"no-extra-boolean-cast": 2,
30+
"no-extra-semi": 2,
31+
"no-fallthrough": 2,
32+
"no-func-assign": 2,
33+
"no-global-assign": 2,
34+
"no-inner-declarations": 2,
35+
"no-invalid-regexp": 2,
36+
"no-irregular-whitespace": 2,
37+
"no-mixed-spaces-and-tabs": 2,
38+
"no-new-symbol": 2,
39+
"no-obj-calls": 2,
40+
"no-octal": 2,
41+
"no-redeclare": 2,
42+
"no-regex-spaces": 2,
43+
"no-self-assign": 2,
44+
"no-sparse-arrays": 2,
45+
"no-this-before-super": 2,
46+
"no-undef": 2,
47+
"no-unexpected-multiline": 2,
48+
"no-unreachable": 2,
49+
"no-unsafe-finally": 2,
50+
"no-unsafe-negation": 2,
51+
"no-unused-labels": 2,
52+
"no-unused-vars": 2,
53+
"no-useless-escape": 2,
54+
"require-yield": 2,
55+
"use-isnan": 2,
56+
"valid-typeof": 2,
57+
"arrow-body-style": [2, "as-needed"],
58+
"arrow-parens": [2, "as-needed"],
59+
"yoda": 2
60+
},
61+
"env": {
62+
"browser": true
63+
}
64+
}

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
.svn
3+
._*
4+
*.tgz
5+
.Spotlight-V100
6+
.Trashes
7+
npm-debug.log
8+
node_modules
9+
coverage
10+
11+
# Editor and IDE configuration
12+
.vscode/
13+
.idea/

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# @composi/merge
2+
3+
This function takes objects and returns a new object with all of their properties. The last object's properties will replace those of the earlier when these have the same name.
4+
5+
Merge does a deep copy of objects, but ignores non-iterable properties.
6+
7+
### Note:
8+
9+
Passing in non-object values, such as string or numbers, will result in unpredictable results. Merge must be used only for combining objects.
10+
11+
## Install
12+
13+
```
14+
npm install --save-dev @composi/merge
15+
```
16+
17+
## Using
18+
19+
Merge two objects:
20+
21+
```javascript
22+
import { merge } from '@composi/merge'
23+
24+
const obj1 = {name: 'Mary'}
25+
const obj2 = {job: 'project manager'}
26+
const person = merge(obj1, obj2)
27+
// returns {name: 'Mary', job: 'project manager'}
28+
```
29+
30+
## Clone an Object
31+
32+
You can clone an object with merge. Just pass in the object. The return object will be a clone:
33+
34+
```javascript
35+
import { merge } from '@composi/merge'
36+
37+
const obj1 = {name: 'Joe', job: 'mechanic'}
38+
const obj2 = merge(obj1)
39+
obj1 === obj2 // returns false
40+
```

0 commit comments

Comments
 (0)