summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/lodash/isBuffer.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/node_modules/lodash/isBuffer.js')
-rw-r--r--tools/eslint/node_modules/lodash/isBuffer.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/lodash/isBuffer.js b/tools/eslint/node_modules/lodash/isBuffer.js
new file mode 100644
index 0000000000..1e6b8b6d38
--- /dev/null
+++ b/tools/eslint/node_modules/lodash/isBuffer.js
@@ -0,0 +1,42 @@
+var constant = require('./constant'),
+ root = require('./_root');
+
+/** Used to determine if values are of the language type `Object`. */
+var objectTypes = {
+ 'function': true,
+ 'object': true
+};
+
+/** Detect free variable `exports`. */
+var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
+
+/** Detect free variable `module`. */
+var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
+
+/** Detect the popular CommonJS extension `module.exports`. */
+var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null;
+
+/** Built-in value references. */
+var Buffer = moduleExports ? root.Buffer : undefined;
+
+/**
+ * Checks if `value` is a buffer.
+ *
+ * @static
+ * @memberOf _
+ * @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
+ */
+var isBuffer = !Buffer ? constant(false) : function(value) {
+ return value instanceof Buffer;
+};
+
+module.exports = isBuffer;