Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
698 bytes
|
Line | |
---|
1 | /*!
|
---|
2 | * Determine if an object is a Buffer
|
---|
3 | *
|
---|
4 | * @author Feross Aboukhadijeh <https://feross.org>
|
---|
5 | * @license MIT
|
---|
6 | */
|
---|
7 |
|
---|
8 | // The _isBuffer check is for Safari 5-7 support, because it's missing
|
---|
9 | // Object.prototype.constructor. Remove this eventually
|
---|
10 | module.exports = function (obj) {
|
---|
11 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
|
---|
12 | }
|
---|
13 |
|
---|
14 | function isBuffer (obj) {
|
---|
15 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
---|
16 | }
|
---|
17 |
|
---|
18 | // For Node v0.10 support. Remove this eventually.
|
---|
19 | function isSlowBuffer (obj) {
|
---|
20 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
---|
21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.