UNPKG

util-ex

Version:

Browser-friendly enhanced util fully compatible with standard node.js

15 lines (14 loc) 648 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isBuffer = exports.default = void 0; /** * Check if a value is a Buffer object. * @param {*} arg - The value to check. * @returns {boolean} - Returns `true` if `arg` is a Buffer object, else `false`. */ const isBuffer = exports.isBuffer = typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function' ? Buffer.isBuffer : function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.binarySlice === 'function'; }; var _default = exports.default = isBuffer;