fix: Fix compiling in Deno

This commit is contained in:
raon0211 2024-11-22 22:46:36 +09:00
parent eba8478bda
commit 54858f954a
10 changed files with 23 additions and 29 deletions

View File

@ -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`。
## 例

View File

@ -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`.
## 예시

View File

@ -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

View File

@ -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`
## 示例

View File

@ -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.

View File

@ -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';
/**

View File

@ -1,4 +1,4 @@
import { sumBy } from './sumBy';
import { sumBy } from './sumBy.ts';
/**
* Computes the sum of the `number` values in `array`.

View File

@ -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`.

View File

@ -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.

View File

@ -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);
}