Skip to content

Commit

Permalink
docs: 优化数组文档
Browse files Browse the repository at this point in the history
  • Loading branch information
renzp94 committed Jul 5, 2024
1 parent a86bae8 commit 68427f1
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion docs/pages/array/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

扁平化数组。默认深度扁平化,如果不需要全部深度扁平化,可通过`depth`来指定要扁平化的深度。如果需要扁平化对象数组,如树结构的数据可以指定`deepKey`属性来指定根据`deepKey`属性来扁平化。

> 注意:`depth`小于等于`0`时将不进行扁平化操作
::: tip 注意
`depth`小于等于`0`时将不进行扁平化操作。
:::

## 基本用法

Expand Down
Binary file added docs/pages/array/images/intersection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/array/images/union.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/array/images/xor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/pages/array/intersection.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

数组取交集。

<img src="./images/intersection.png" height="300" width="300" />

## 基本用法

传入多个数组,使用[SameValueZero](https://262.ecma-international.org/6.0/#sec-samevaluezero)进行比较,返回含有交集数据的数组。
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/array/objectify.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ objectify(list, 'key');

## 自定义key

第二个参数可传入目标数组中的对象属性名,则自动将`对象.属性名`作为转换对象的属性。也可传入一个函数,函数返回值用于自定义转换对象的属性。
第二个参数可传入目标数组中的对象属性名,则自动将`对象.属性名`取到的值作为转换对象的属性。也可传入一个函数,函数返回值用于自定义转换对象的属性。

```ts
import { createArray, objectify } from '@renzp/utils';
Expand Down Expand Up @@ -70,7 +70,7 @@ objectify(list, (v) => `p_${v.key}`);

## 自定义value

第三个参数可指定转换对象的属性值,如果不传,则使用当前对象作为value。可使用目标数组中的对象属性名,则自动将`对象.属性名`作为转换对象的属性值。也可传入一个函数,函数返回值用于自定义转换对象的属性值。
第三个参数可指定转换对象的属性值,如果不传,则使用当前对象作为value。可使用目标数组中的对象属性名,则自动将`对象.属性名`取到的值作为转换对象的属性值。也可传入一个函数,函数返回值用于自定义转换对象的属性值。


```ts
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/array/remove.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# remove

数组取并集
数组删除数据

## 基本用法

Expand Down
2 changes: 2 additions & 0 deletions docs/pages/array/union.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

数组取并集。

<img src="./images/union.png" height="300" width="300" />

## 基本用法

传入多个数组,使用[SameValueZero](https://262.ecma-international.org/6.0/#sec-samevaluezero)进行比较,返回含有并集数据的数组。
Expand Down
3 changes: 3 additions & 0 deletions docs/pages/array/xor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

数组取补集。

<img src="./images/xor.png" height="300" width="300" />


## 基本用法

传入多个数组,使用[SameValueZero](https://262.ecma-international.org/6.0/#sec-samevaluezero)进行比较,返回含有补集数据的数组。
Expand Down

0 comments on commit 68427f1

Please sign in to comment.