项目原始demo,不改动
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
Questo repository è archiviato. Puoi vedere i file e clonarli, ma non puoi effettuare richieste di pushj o aprire problemi/richieste di pull.
 
 
 
 

22 righe
714 B

  1. /**
  2. * A faster alternative to `Function#apply`, this function invokes `func`
  3. * with the `this` binding of `thisArg` and the arguments of `args`.
  4. *
  5. * @private
  6. * @param {Function} func The function to invoke.
  7. * @param {*} thisArg The `this` binding of `func`.
  8. * @param {Array} args The arguments to invoke `func` with.
  9. * @returns {*} Returns the result of `func`.
  10. */
  11. function apply(func, thisArg, args) {
  12. switch (args.length) {
  13. case 0: return func.call(thisArg);
  14. case 1: return func.call(thisArg, args[0]);
  15. case 2: return func.call(thisArg, args[0], args[1]);
  16. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  17. }
  18. return func.apply(thisArg, args);
  19. }
  20. module.exports = apply;