_.isBuffer(value)
value _.
2023-09-11 14:15:01 时间
132
_.isBuffer(value)
_.isBuffer判断一个值是否是一个buffer对象
参数
value (*): 需要检查的值
返回值
(boolean): 如果是buffer对象返回true,否则false
例子
_.isBuffer(new Buffer(2)); // => true _.isBuffer(new Uint8Array(2)); // => false
源代码
import root from './.internal/root.js' /** Detect free variable `exports`. */ //探测exports对象 const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports /** Detect free variable `module`. */ //探测module对象 const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module /** Detect the popular CommonJS extension `module.exports`. */ //探测module.exports对象 const moduleExports = freeModule && freeModule.exports === freeExports /** Built-in value references. */ //内置的Buffer对象引用 const Buffer = moduleExports ? root.Buffer : undefined /* Built-in method references for those with the same name as other `lodash` methods. */ //内置方法引用,引用原生的Buffer.isBuffer方法 const nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined /** * Checks if `value` is a buffer. * * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * isBuffer(new Buffer(2)) * // => true * * isBuffer(new Uint8Array(2)) * // => false */ //判断一个值是否是一个buffer对象 const isBuffer = nativeIsBuffer || (() => false) export default isBuffer
相关文章
- Json.Net - Error getting value from 'ScopeId' on 'System.Net.IPAddress'
- jquery获取json对象中的key小技巧,遍历json串所有key,value
- LLVM Constant Value to c++ value
- [ARIA] Add aria-expanded to add semantic value and styling
- Configuration类的@Value属性值为null
- [RxJS] AsyncSubject: representing a computation that yields a final value
- About NULL Value
- swift Any转字典Dictionary Cannot convert value of type ‘Any‘ to specified type ‘Dictionary<Key, Value>‘
- 成功解决_catboost.CatBoostError: Bad value for num_feature: Cannot convert ‘b‘x8fx91‘‘ to float
- 成功解决pandascoregeneric.py:3660: SettingWithCopyWarning: A value is trying to be set on a copy of a
- argeting S+ (version 31 and above) requires that an explicit value for android:exported be defined w
- Spring @Value注解 and Spring Boot @ConfigurationProperties注解
- 读取 properties 配置文件含有中文的value内容 导致中文乱码 的解决办法
- 全网最完美地解决使用spring boot的@Value(“${xxx}“)注解时报出的错误:Could not resolve placeholder ‘xxx‘ in value “${xxx}“