Skip to content

Commit

Permalink
doc: adding example to Buffer.isBuffer method
Browse files Browse the repository at this point in the history
PR-URL: #36233
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
  • Loading branch information
ntedgi authored and targos committed May 1, 2021
1 parent 1d78d50 commit 6201f23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,14 @@ added: v0.1.101

Returns `true` if `obj` is a `Buffer`, `false` otherwise.

```js
Buffer.isBuffer(Buffer.alloc(10)); // true
Buffer.isBuffer(Buffer.from('foo')); // true
Buffer.isBuffer('a string'); // false
Buffer.isBuffer([]); // false
Buffer.isBuffer(new Uint8Array(1024)); // false
```

### Static method: `Buffer.isEncoding(encoding)`
<!-- YAML
added: v0.9.1
Expand Down

0 comments on commit 6201f23

Please sign in to comment.