|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
714 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Checks if the given value is a Buffer instance.
|
|---|
| 3 | *
|
|---|
| 4 | * This function tests whether the provided value is an instance of Buffer.
|
|---|
| 5 | * It returns `true` if the value is a Buffer, and `false` otherwise.
|
|---|
| 6 | *
|
|---|
| 7 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
|
|---|
| 8 | *
|
|---|
| 9 | * @param {unknown} x - The value to check if it is a Buffer.
|
|---|
| 10 | * @returns {boolean} Returns `true` if `x` is a Buffer, else `false`.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const buffer = Buffer.from("test");
|
|---|
| 14 | * console.log(isBuffer(buffer)); // true
|
|---|
| 15 | *
|
|---|
| 16 | * const notBuffer = "not a buffer";
|
|---|
| 17 | * console.log(isBuffer(notBuffer)); // false
|
|---|
| 18 | */
|
|---|
| 19 | declare function isBuffer(x: unknown): boolean;
|
|---|
| 20 |
|
|---|
| 21 | export { isBuffer };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.