Version 1
[yaffs-website] / node_modules / grunt-legacy-log / node_modules / lodash / internal / createBindWrapper.js
diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/internal/createBindWrapper.js b/node_modules/grunt-legacy-log/node_modules/lodash/internal/createBindWrapper.js
new file mode 100644 (file)
index 0000000..54086ee
--- /dev/null
@@ -0,0 +1,22 @@
+var createCtorWrapper = require('./createCtorWrapper');
+
+/**
+ * Creates a function that wraps `func` and invokes it with the `this`
+ * binding of `thisArg`.
+ *
+ * @private
+ * @param {Function} func The function to bind.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @returns {Function} Returns the new bound function.
+ */
+function createBindWrapper(func, thisArg) {
+  var Ctor = createCtorWrapper(func);
+
+  function wrapper() {
+    var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
+    return fn.apply(thisArg, arguments);
+  }
+  return wrapper;
+}
+
+module.exports = createBindWrapper;