UNPKG

640 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.isBuffer = isBuffer;
7
8var _has = require("../has");
9
10// Copyright 2017-2022 @polkadot/util authors & contributors
11// SPDX-License-Identifier: Apache-2.0
12
13/**
14 * @name isBuffer
15 * @summary Tests for a `Buffer` object instance.
16 * @description
17 * Checks to see if the input object is an instance of `Buffer`.
18 * @example
19 * <BR>
20 *
21 * ```javascript
22 * import { isBuffer } from '@polkadot/util';
23 *
24 * console.log('isBuffer', isBuffer(Buffer.from([]))); // => true
25 * ```
26 */
27function isBuffer(value) {
28 return _has.hasBuffer && Buffer.isBuffer(value);
29}
\No newline at end of file