web 3d图形渲染器
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.

22 lines
541 B

  1. "use strict";
  2. var mixin = require("../../object/mixin")
  3. , validFunction = require("../valid-function")
  4. , re = /^\s*function\s*([\0-')-\uffff]+)*\s*\(([\0-(*-\uffff]*)\)\s*\{/;
  5. module.exports = function () {
  6. var match = String(validFunction(this)).match(re), fn;
  7. // eslint-disable-next-line no-new-func
  8. fn = new Function(
  9. "fn",
  10. "return function " +
  11. match[1].trim() +
  12. "(" +
  13. match[2] +
  14. ") { return fn.apply(this, arguments); };"
  15. )(this);
  16. try { mixin(fn, this); }
  17. catch (ignore) {}
  18. return fn;
  19. };