-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
229 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# isDOMException | ||
|
||
Determine whether the input value is a `DOMException` object. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isDOMException } from 'rattail' | ||
|
||
isDOMException(new DOMException('An error occurred')) // return true | ||
isDOMException(new Error('An error occurred')) // return false | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ----- | :---: | -------: | | ||
| `val` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# isEqualWith | ||
|
||
Deeply compare two values. Supports passing a comparison method, and returns `true` if the two values are equal. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isEqualWith, isObject } from 'rattail' | ||
|
||
isEqualWith([1, 2], ['1', '2'], (v1, v2) => { | ||
if (!isObject(v1) && !isObject(v2)) { | ||
return String(v1) === String(v2) | ||
} | ||
}) | ||
// return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---------------------: | -------: | | ||
| `value` | `any` | | | ||
| `other` | `any` | | | ||
| `fn` | `(value, other) => any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# isEqual | ||
|
||
Deeply compare two values. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isEqual } from 'rattail' | ||
|
||
isEqual({ n: 1 }, { n: 1 }) | ||
// return true | ||
isEqual([1, 2, 3], [1, 2, 3]) | ||
// return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ------- | :---: | -------: | | ||
| `value` | `any` | | | ||
| `other` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isError | ||
|
||
Determine whether the input value is an `Error` object. | ||
|
||
### Usage | ||
|
||
```ts | ||
import { isError } from 'rattail' | ||
|
||
isError(new Error('message')) // return true | ||
``` | ||
|
||
### Arguments | ||
|
||
| Arg | Type | Defaults | | ||
| ----- | :---: | -------: | | ||
| `val` | `any` | | | ||
|
||
### Return | ||
|
||
| Type | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# isDOMException | ||
|
||
判断输入值是否为 `DOMException` 对象。 | ||
|
||
### 使用 | ||
|
||
```ts | ||
import { isDOMException } from 'rattail' | ||
|
||
isDOMException(new DOMException('An error occurred')) // return true | ||
isDOMException(new Error('An error occurred')) // return false | ||
``` | ||
|
||
### 参数列表 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ----- | :---: | -----: | | ||
| `val` | `any` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# isEqualWith | ||
|
||
深度比较两个值。支持传入一个比较方法,返回 `true` 时表示两个值相等。 | ||
|
||
### 使用 | ||
|
||
```ts | ||
import { isEqualWith, isObject } from 'rattail' | ||
|
||
isEqualWith([1, 2], ['1', '2'], (v1, v2) => { | ||
if (!isObject(v1) && !isObject(v2)) { | ||
return String(v1) === String(v2) | ||
} | ||
}) | ||
// return true | ||
``` | ||
|
||
### 参数列表 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ------- | :---------------------: | -----: | | ||
| `value` | `any` | | | ||
| `other` | `any` | | | ||
| `fn` | `(value, other) => any` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# isEqual | ||
|
||
深度比较两个值。 | ||
|
||
### 使用 | ||
|
||
```ts | ||
import { isEqual } from 'rattail' | ||
|
||
isEqual({ n: 1 }, { n: 1 }) | ||
// return true | ||
isEqual([1, 2, 3], [1, 2, 3]) | ||
// return true | ||
``` | ||
|
||
### 参数列表 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ------- | :---: | -----: | | ||
| `value` | `any` | | | ||
| `other` | `any` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# isError | ||
|
||
判断输入值是否为 `Error` 对象。 | ||
|
||
### 使用 | ||
|
||
```ts | ||
import { isError } from 'rattail' | ||
|
||
isError(new Error('message')) // return true | ||
``` | ||
|
||
### 参数列表 | ||
|
||
| 参数 | 类型 | 默认值 | | ||
| ----- | :---: | -----: | | ||
| `val` | `any` | | | ||
|
||
### 返回值 | ||
|
||
| 类型 | | ||
| :-------: | | ||
| `boolean` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters