Skip to content

Commit

Permalink
deploy: 04e7c1a
Browse files Browse the repository at this point in the history
  • Loading branch information
MJmajiong committed Sep 27, 2024
0 parents commit 0a92e16
Show file tree
Hide file tree
Showing 64 changed files with 2,065 additions and 0 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-cayman
62 changes: 62 additions & 0 deletions brick-next-pipes.add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [add](./brick-next-pipes.add.md)

## add() function

数学加法或字符串拼接。

Mathematics

**Signature:**

```typescript
export declare function add(value: number | string, operand: number | string): number | string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | number \| string | 值。 |
| operand | number \| string | 操作数。 |

**Returns:**

number \| string

如果其中一个参数为字符串,返回字符串,否则返回数字。

## Remarks

详见 [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition)<!-- -->

## Example

数学加法:

```ts
// Number + Number -> addition
1 + 2 // 3

// Boolean + Number -> addition
true + 1 // 2

// Boolean + Boolean -> addition
false + false // 0
```

字符串拼接:

```ts
// String + String -> concatenation
'foo' + 'bar' // "foobar"

// Number + String -> concatenation
5 + 'foo' // "5foo"

// String + Boolean -> concatenation
'foo' + false // "foofalse"
```


28 changes: 28 additions & 0 deletions brick-next-pipes.atobunicode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [atobUnicode](./brick-next-pipes.atobunicode.md)

## atobUnicode() function

支持base64字符解码为中文

Logic

**Signature:**

```typescript
export declare function atobUnicode(value: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | string | 需要进行解码的值 |

**Returns:**

string

解码后的值

32 changes: 32 additions & 0 deletions brick-next-pipes.boolean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [boolean](./brick-next-pipes.boolean.md)

## boolean() function

将一个值转换为布尔值(也可使用别名 `bool`<!-- -->)。

Type conversion

**Signature:**

```typescript
export declare function boolean(value: unknown): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | unknown | 需要转换的值。 |

**Returns:**

boolean

转换后的布尔值。

## Remarks

该转换会把字符串的 `"0"` 也看作 `false`<!-- -->

28 changes: 28 additions & 0 deletions brick-next-pipes.btoaunicode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [btoaUnicode](./brick-next-pipes.btoaunicode.md)

## btoaUnicode() function

支持将中文进行base64编码

Logic

**Signature:**

```typescript
export declare function btoaUnicode(value: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | string | 需要进行编码的值 |

**Returns:**

string

编码后的值

46 changes: 46 additions & 0 deletions brick-next-pipes.cmdbinstanceshowname.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [cmdbInstanceShowName](./brick-next-pipes.cmdbinstanceshowname.md)

## cmdbInstanceShowName() function

获得一个 CMDB 实例的展示名。

Others

**Signature:**

```typescript
export declare function cmdbInstanceShowName(value: string | string[]): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | string \| string\[\] | 用于展示的(一个或多个)属性值。 |

**Returns:**

string

实例的展示名。

## Example


```ts
cmdbInstancesShowName("Foo")
// Returns "Foo".

cmdbInstancesShowName(["Foo", "Bar"])
// Returns "Foo(Bar)".

cmdbInstancesShowName(["Foo", "Bar", "Baz"])
// Returns "Foo(Bar, Baz)".

cmdbInstancesShowName(["Foo"])
// Returns "Foo".
```


45 changes: 45 additions & 0 deletions brick-next-pipes.countby.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [countBy](./brick-next-pipes.countby.md)

## countBy() function

统计一个集合中每个元素的指定属性(或迭代器执行结果)的值出现的次数。

Collection

**Signature:**

```typescript
export declare function countBy(collection: unknown[] | Record<string, unknown>, iteratee: string | number): Record<string, number>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| collection | unknown\[\] \| Record&lt;string, unknown&gt; | 数据集合。 |
| iteratee | string \| number | 属性名(或迭代器)。 |

**Returns:**

Record&lt;string, number&gt;

统计结果。

## Remarks

透传调用 [\_.countBy](https://lodash.com/docs/#countBy)<!-- -->

## Example


```ts
countBy([6.1, 4.2, 6.3], Math.floor);
// => { '4': 1, '6': 2 }

countBy(['one', 'two', 'three'], 'length');
// => { '3': 2, '5': 1 }
```


41 changes: 41 additions & 0 deletions brick-next-pipes.datetime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [datetime](./brick-next-pipes.datetime.md)

## datetime() function

日期时间格式化(使用当地时区)。

Datetime

**Signature:**

```typescript
export declare function datetime(value: number | string, format: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | number \| string | 日期时间字符串或 Unix 时间戳([https://momentjs.com/docs/\#/parsing/string/](https://momentjs.com/docs/#/parsing/string/)<!-- -->)。 |
| format | string | 输出格式。 |

**Returns:**

string

格式化后的日期时间。

## Example


```ts
datetime(1582877669000, "YYYY-MM-DD")
// Returns "2020-02-28"

datetime("2020-02-28T17:14", "YYYY-MM-DD")
// Returns "2020-02-28"
```


56 changes: 56 additions & 0 deletions brick-next-pipes.deltatime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [deltaTime](./brick-next-pipes.deltatime.md)

## deltaTime() function

将一个时间段转换为人类可读的文本。

Datetime

**Signature:**

```typescript
export declare function deltaTime(time: number | string | Period, withSuffix?: boolean, format?: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| time | number \| string \| [Period](./brick-next-pipes.period.md) | 指定时间(字符串或 UNIX 时间戳)或时间段。 |
| withSuffix | boolean | 是否添加后缀(默认为 <code>true</code>)。 |
| format | string | 输入的时间格式(使用时间戳时可忽略,默认为 <code>&quot;YYYY-MM-DD HH:mm:ss&quot;</code>)。 |

**Returns:**

string

人类可读的时间段显示。

## Remarks

给定一个时间段(`startTime``endTime`<!-- -->),将它转换为人类可读的文本。

当输入时间为单个值时,则计算它与当前时间的间隔时间段。

## Example


```ts
// Assuming now is "2019-05-10 17:51:00".

deltaTime("2019-05-10 17:21:00")
// Returns "30 minutes ago"

deltaTime("2019-05-10 18:51:00")
// Returns "in an hour"

deltaTime({ startTime: "2019-05-10", endTime: "2019-06-10" }, false)
// Returns "a month"

deltaTime({ startTime: "2019-05-10 17:48:00" }, false)
// Returns "3 minutes"
```


29 changes: 29 additions & 0 deletions brick-next-pipes.divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@easyops-cn/brick-next-pipes](./brick-next-pipes.md) &gt; [divide](./brick-next-pipes.divide.md)

## divide() function

数学除法。

Mathematics

**Signature:**

```typescript
export declare function divide(value: number, operand: number): number;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | number | 被除数。 |
| operand | number | 除数。 |

**Returns:**

number

商。

Loading

0 comments on commit 0a92e16

Please sign in to comment.