diff --git a/zh-cn/deepmerge.md b/zh-cn/deepmerge.md new file mode 100644 index 0000000000000000000000000000000000000000..ae798d8a0206e023fc5df9f77a53f7d8ef0254d8 --- /dev/null +++ b/zh-cn/deepmerge.md @@ -0,0 +1,90 @@ +> 模板版本:v0.0.1 + +

+

deepmerge

+

+

+ + License + +

+ +## 安装与使用 + +进入到工程目录并输入以下命令: + +#### **yarn** + +```bash +yarn add deepmerge +``` + + +#### **npm** + +```bash +npm install deepmerge +``` + + + +下面的代码展示了这个库的基本使用场景: + +```js +import deepmerge from 'deepmerge' + +const x = { + foo: { bar: 3 }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }] +} + +const y = { + foo: { baz: 4 }, + quux: 5, + array: [{ + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }] +} + +const output = { + foo: { + bar: 3, + baz: 4 + }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }, { + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }], + quux: 5 +} + +deepmerge(x, y) // => output +``` + +## 约束与限制 + +## API + +| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 | +| ---- | ---- | ---- | -------- | -------- | -------- | +| deepmerge(x, y, [options]) | Merge two objects x and y deeply, returning a new merged object with the elements from both x and y. | function | No | / | Yes | +| deepmerge.all(arrayOfObjects, [options]) | Merges any number of objects into a single result object. | function | No | / | Yes | + +## 遗留问题 + +## 其他 + +## 开源协议 + +本项目基于 [The MIT License (MIT)](https://github.com/TehShrike/deepmerge/blob/master/license.txt) ,请自由地享受和参与开源。