26 lines
819 B
JavaScript
26 lines
819 B
JavaScript
|
|
import { isBuffer as isBuffer$1 } from "../../predicate/isBuffer.mjs";
|
||
|
|
//#region src/compat/predicate/isBuffer.ts
|
||
|
|
/**
|
||
|
|
* 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`.
|
||
|
|
*
|
||
|
|
* @param {any} x - The value to check if it is a Buffer.
|
||
|
|
* @returns {boolean} Returns `true` if `x` is a Buffer, else `false`.
|
||
|
|
*
|
||
|
|
* @example
|
||
|
|
* const buffer = Buffer.from("test");
|
||
|
|
* console.log(isBuffer(buffer)); // true
|
||
|
|
*
|
||
|
|
* const notBuffer = "not a buffer";
|
||
|
|
* console.log(isBuffer(notBuffer)); // false
|
||
|
|
*/
|
||
|
|
function isBuffer(x) {
|
||
|
|
return isBuffer$1(x);
|
||
|
|
}
|
||
|
|
//#endregion
|
||
|
|
export { isBuffer };
|