mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-23 10:06:47 +03:00
fix: Fix compiling in Deno
This commit is contained in:
parent
eba8478bda
commit
54858f954a
@ -4,12 +4,10 @@
|
||||
|
||||
値がBufferの場合は`true`を返し、それ以外の場合は`false`を返します。
|
||||
|
||||
この関数はTypeScriptで型述語としても機能し、引数の型を `Buffer` に狭めます。
|
||||
|
||||
## インターフェース
|
||||
|
||||
```typescript
|
||||
function isBuffer(x: unknown): x is Buffer;
|
||||
function isBuffer(x: unknown): boolean;
|
||||
```
|
||||
|
||||
### パラメータ
|
||||
@ -18,8 +16,7 @@ function isBuffer(x: unknown): x is Buffer;
|
||||
|
||||
### 戻り値
|
||||
|
||||
(`x is Buffer`): `x`がBufferの場合は`true`、それ以外の場合は`false`。
|
||||
数値配列。
|
||||
(`boolean`): `x`がBufferの場合は`true`、それ以外の場合は`false`。
|
||||
|
||||
## 例
|
||||
|
||||
|
@ -9,7 +9,7 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
|
||||
## 인터페이스
|
||||
|
||||
```typescript
|
||||
function isBuffer(x: unknown): x is Buffer;
|
||||
function isBuffer(x: unknown): boolean;
|
||||
```
|
||||
|
||||
### 파라미터
|
||||
@ -18,7 +18,7 @@ function isBuffer(x: unknown): x is Buffer;
|
||||
|
||||
### 반환 값
|
||||
|
||||
(`x is Buffer`): `x`가 Buffer이면 `true`, 그렇지 않으면 `false`.
|
||||
(`boolean`): `x`가 Buffer이면 `true`, 그렇지 않으면 `false`.
|
||||
|
||||
## 예시
|
||||
|
||||
|
@ -5,12 +5,10 @@ Checks if the given value is a Buffer instance.
|
||||
This function tests whether the provided value is an instance of Buffer.
|
||||
It returns `true` if the value is a Buffer, and `false` otherwise.
|
||||
|
||||
This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
|
||||
|
||||
## Signature
|
||||
|
||||
```typescript
|
||||
function isBuffer(x: unknown): x is Buffer;
|
||||
function isBuffer(x: unknown): boolean;
|
||||
```
|
||||
|
||||
### Parameters
|
||||
@ -19,7 +17,7 @@ function isBuffer(x: unknown): x is Buffer;
|
||||
|
||||
### Returns
|
||||
|
||||
(`x is Buffer`): Returns `true` if `x` is a Buffer, else `false`.
|
||||
(`boolean`): Returns `true` if `x` is a Buffer, else `false`.
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -4,12 +4,10 @@
|
||||
|
||||
如果该值是 Buffer,则返回 `true`,否则返回 `false`。
|
||||
|
||||
此函数也可以作为 TypeScript 中的类型谓词, 将参数的类型缩小为 `Buffer`。
|
||||
|
||||
## 签名
|
||||
|
||||
```typescript
|
||||
function isBuffer(x: unknown): x is Buffer;
|
||||
function isBuffer(x: unknown): boolean;
|
||||
```
|
||||
|
||||
### 参数
|
||||
@ -18,7 +16,7 @@ function isBuffer(x: unknown): x is Buffer;
|
||||
|
||||
### 返回值
|
||||
|
||||
(`x is Buffer`): 如果 `x` 是 Buffer 则返回 `true`,否则返回 `false`。
|
||||
(`boolean`): 如果 `x` 是 Buffer 则返回 `true`,否则返回 `false`。
|
||||
|
||||
## 示例
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { identity } from '../../function/identity';
|
||||
import { range } from '../../math/range';
|
||||
import { isArrayLike } from '../predicate/isArrayLike';
|
||||
import { identity } from '../../function/identity.ts';
|
||||
import { range } from '../../math/range.ts';
|
||||
import { isArrayLike } from '../predicate/isArrayLike.ts';
|
||||
|
||||
/**
|
||||
* Iterates over each element of the array invoking the provided callback function for each element.
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { uniqBy as uniqByToolkit } from '../../array/uniqBy';
|
||||
import { isArrayLikeObject } from '../predicate/isArrayLikeObject';
|
||||
import { uniqBy as uniqByToolkit } from '../../array/uniqBy.ts';
|
||||
import { isArrayLikeObject } from '../predicate/isArrayLikeObject.ts';
|
||||
import { iteratee as createIteratee } from '../util/iteratee.ts';
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { sumBy } from './sumBy';
|
||||
import { sumBy } from './sumBy.ts';
|
||||
|
||||
/**
|
||||
* Computes the sum of the `number` values in `array`.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { iteratee as iterateeToolkit } from '../util/iteratee';
|
||||
import { iteratee as iterateeToolkit } from '../util/iteratee.ts';
|
||||
|
||||
/**
|
||||
* Computes the sum of the `number` values in `array`.
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { isBuffer } from '../../predicate/isBuffer';
|
||||
import { isPrototype } from '../_internal/isPrototype';
|
||||
import { isArrayLike } from '../predicate/isArrayLike';
|
||||
import { isTypedArray } from '../predicate/isTypedArray';
|
||||
import { times } from '../util/times';
|
||||
import { isBuffer } from '../../predicate/isBuffer.ts';
|
||||
import { isPrototype } from '../_internal/isPrototype.ts';
|
||||
import { isArrayLike } from '../predicate/isArrayLike.ts';
|
||||
import { isTypedArray } from '../predicate/isTypedArray.ts';
|
||||
import { times } from '../util/times.ts';
|
||||
|
||||
/**
|
||||
* This function retrieves the names of string-keyed properties from an object, including those inherited from its prototype.
|
||||
|
@ -13,7 +13,7 @@ declare let Buffer:
|
||||
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
|
||||
*
|
||||
* @param {unknown} x - The value to check if it is a Buffer.
|
||||
* @returns {x is Buffer} Returns `true` if `x` is a Buffer, else `false`.
|
||||
* @returns {boolean} Returns `true` if `x` is a Buffer, else `false`.
|
||||
*
|
||||
* @example
|
||||
* const buffer = Buffer.from("test");
|
||||
@ -22,6 +22,7 @@ declare let Buffer:
|
||||
* const notBuffer = "not a buffer";
|
||||
* console.log(isBuffer(notBuffer)); // false
|
||||
*/
|
||||
export function isBuffer(x: unknown): x is Buffer {
|
||||
export function isBuffer(x: unknown): boolean {
|
||||
// @ts-ignore
|
||||
return typeof Buffer !== 'undefined' && Buffer.isBuffer(x);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user