You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

is-plain-function.js 350B

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. };