Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update review suggestions writing shorter tests
  • Loading branch information
ntedgi committed Nov 23, 2020
commit e4bd2e18f24e4ddc849517dcda21dbed2f02f94e
20 changes: 5 additions & 15 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,21 +745,11 @@ Returns `true` if `obj` is a `Buffer`, `false` otherwise.

```js

Comment thread
ntedgi marked this conversation as resolved.
Outdated
const buf1 = Buffer.alloc(10);
console.log(Buffer.isBuffer(buf1));
// Prints: true

const buf2 = Buffer.from('this is a test');
console.log(Buffer.isBuffer(buf2));
// Prints: true

const str = 'a string';
console.log(Buffer.isBuffer(str));
// Prints: false

const arr = [];
console.log(Buffer.isBuffer(arr));
// Prints: false
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

Comment thread
ntedgi marked this conversation as resolved.
Outdated
```
### Static method: `Buffer.isEncoding(encoding)`
Expand Down