Skip to content

Commit 472ed5a

Browse files
committed
doc: updated chinese docs
1 parent 90d54af commit 472ed5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+707
-35
lines changed

i18n/zh/docusaurus-plugin-content-docs/current/accumulate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [math, array, beginner]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "accumulate" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "accumulate" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

i18n/zh/docusaurus-plugin-content-docs/current/all.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [array, function, beginner]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "all" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "all" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

i18n/zh/docusaurus-plugin-content-docs/current/allEqual.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [array, function, beginner]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "AllEqual" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "AllEqual" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: bifurcate
3+
tags: [array, intermediate]
4+
author_title: Deepak Vishwakarma
5+
author_url: https://github.com/deepakshrma
6+
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "bifurcate" 的方法。
8+
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
9+
---
10+
11+
![TS](https://img.shields.io/badge/supports-typescript-blue.svg?style=flat-square)
12+
![JS](https://img.shields.io/badge/supports-javascript-yellow.svg?style=flat-square)
13+
![Deno](https://img.shields.io/badge/supports-deno-green.svg?style=flat-square)
14+
15+
将值分成两组。如果 `filter` 中的元素为真值,则集合中对应的元素属于第一组;否则,它属于第二组。
16+
17+
使用 `Array.prototype.reduce()``Array.prototype.push()` 根据 `filter` 将元素添加到组中。
18+
19+
```ts title="typescript"
20+
const bifurcate = <T = any>(arr: T[], filter: boolean[]) =>
21+
arr.reduce(
22+
(acc, val, i) => {
23+
acc[filter[i] ? 0 : 1].push(val);
24+
return acc;
25+
},
26+
[[] as T[], [] as T[]]
27+
);
28+
```
29+
30+
```ts title="typescript"
31+
bifurcate(["beep", "boop", "foo", "bar"], [true, true, false, true]); // [ ['beep', 'boop', 'bar'], ['foo'] ]
32+
```

i18n/zh/docusaurus-plugin-content-docs/current/capitalize.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [string, array, intermediate]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "capitalize" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "capitalize" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

i18n/zh/docusaurus-plugin-content-docs/current/capitalizeEveryWord.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [string, regexp, intermediate]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "capitalizeEveryWord" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "capitalizeEveryWord" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

i18n/zh/docusaurus-plugin-content-docs/current/chunk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [array, intermediate]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "chunk" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "chunk" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: colorize [给文本着色]
3+
tags: [node, string, intermediate]
4+
author_title: Deepak Vishwakarma
5+
author_url: https://github.com/deepakshrma
6+
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "colorize" 的方法。
8+
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
9+
---
10+
11+
![TS](https://img.shields.io/badge/supports-typescript-blue.svg?style=flat-square)
12+
![JS](https://img.shields.io/badge/supports-nodejs-yellow.svg?style=flat-square)
13+
![Deno](https://img.shields.io/badge/supports-deno-green.svg?style=flat-square)
14+
15+
在控制台中添加特殊字符到文本中以彩色打印(与 `console.log()` 结合使用)。
16+
17+
使用模板文字和特殊字符为字符串输出添加适当的颜色代码。
18+
对于背景颜色,添加一个在字符串末尾重置背景颜色的特殊字符。
19+
20+
```ts title="typescript"
21+
export const colorize = new (class {
22+
color = (code: number, ended = false, ...messages: any[]) =>
23+
`\x1b[${code}m${messages.join(" ")}${ended ? "\x1b[0m" : ""}`;
24+
black = this.color.bind(null, 30, false);
25+
red = this.color.bind(null, 31, false);
26+
green = this.color.bind(null, 32, false);
27+
yellow = this.color.bind(this, 33, false);
28+
blue = this.color.bind(this, 34, false);
29+
magenta = this.color.bind(this, 35, false);
30+
cyan = this.color.bind(this, 36, false);
31+
white = this.color.bind(this, 37, false);
32+
bgBlack = this.color.bind(this, 40, true);
33+
bgRed = this.color.bind(this, 41, true);
34+
bgGreen = this.color.bind(this, 42, true);
35+
bgYellow = this.color.bind(this, 43, true);
36+
bgBlue = this.color.bind(this, 44, true);
37+
bgMagenta = this.color.bind(this, 45, true);
38+
bgCyan = this.color.bind(this, 46, true);
39+
bgWhite = this.color.bind(this, 47, true);
40+
})();
41+
42+
const color = colorize;
43+
```
44+
45+
```ts title="typescript"
46+
console.log(color.red("foo")); // 'foo' (red letters)
47+
console.log(color.bgBlue("foo", "bar")); // 'foo bar' (blue background)
48+
console.log(color.bgWhite(color.yellow("foo"), color.green("foo"))); // 'foo bar' (first
49+
//word in yellow letters, second word in green letters, white background for both)
50+
51+
console.log(colorize.red("foo")); // 'foo' (red letters)
52+
console.log(colorize.bgBlue("foo", "bar")); // 'foo bar' (blue background)
53+
console.log(colorize.bgWhite(colorize.yellow("foo"), colorize.green("foo"))); // 'foo bar' (first
54+
//word in yellow letters, second word in green letters, white background for both)
55+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: compact [压缩]
3+
tags: [array, beginner]
4+
author_title: Deepak Vishwakarma
5+
author_url: https://github.com/deepakshrma
6+
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "compact" 的方法。
8+
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
9+
---
10+
11+
![TS](https://img.shields.io/badge/supports-typescript-blue.svg?style=flat-square)
12+
![JS](https://img.shields.io/badge/supports-javascript-yellow.svg?style=flat-square)
13+
![Deno](https://img.shields.io/badge/supports-deno-green.svg?style=flat-square)
14+
15+
从数组中移除假值。
16+
17+
使用 `Array.prototype.filter()` 来过滤掉假值 `(false、null、0、""、undefined 和 NaN)`
18+
19+
```ts title="typescript"
20+
const compact = (arr: any[]) => arr.filter(Boolean);
21+
```
22+
23+
```ts title="typescript"
24+
compact([0, 1, false, 2, "", 3, "a", Number("e") * 23, NaN, "s", 34]); // [ 1, 2, 3, 'a', 's', 34 ]
25+
```

i18n/zh/docusaurus-plugin-content-docs/current/copyToClipboard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags: [browser, string, advanced]
44
author_title: Deepak Vishwakarma
55
author_url: https://github.com/deepakshrma
66
author_image_url: https://avatars2.githubusercontent.com/u/7682731?s=400
7-
description: Implementation of "copyToClipboard" in typescript, javascript and deno.
7+
description: 在 TypeScript、JavaScript 和 Deno 中实现 "copyToClipboard" 的方法。
88
image: https://www.positronx.io/wp-content/uploads/2018/11/positronx-banner-1152-1.jpg
99
---
1010

0 commit comments

Comments
 (0)