is-plain-function.js 350 B

1234567891011
  1. "use strict";
  2. var isClassStr = RegExp.prototype.test.bind(/^\s*class[\s{/}]/)
  3. , fnToString = Function.prototype.toString;
  4. module.exports = function (fn) {
  5. if (typeof fn !== "function") return false;
  6. if (typeof fn.call !== "function") return false;
  7. if (typeof fn.apply !== "function") return false;
  8. return !isClassStr(fnToString.call(fn));
  9. };