Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

apply.js 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = function (fn, ...args) {
  6. return (...callArgs) => fn(...args, ...callArgs);
  7. };
  8. module.exports = exports["default"]; /**
  9. * Creates a continuation function with some arguments already applied.
  10. *
  11. * Useful as a shorthand when combined with other control flow functions. Any
  12. * arguments passed to the returned function are added to the arguments
  13. * originally passed to apply.
  14. *
  15. * @name apply
  16. * @static
  17. * @memberOf module:Utils
  18. * @method
  19. * @category Util
  20. * @param {Function} fn - The function you want to eventually apply all
  21. * arguments to. Invokes with (arguments...).
  22. * @param {...*} arguments... - Any number of arguments to automatically apply
  23. * when the continuation is called.
  24. * @returns {Function} the partially-applied function
  25. * @example
  26. *
  27. * // using apply
  28. * async.parallel([
  29. * async.apply(fs.writeFile, 'testfile1', 'test1'),
  30. * async.apply(fs.writeFile, 'testfile2', 'test2')
  31. * ]);
  32. *
  33. *
  34. * // the same process without using apply
  35. * async.parallel([
  36. * function(callback) {
  37. * fs.writeFile('testfile1', 'test1', callback);
  38. * },
  39. * function(callback) {
  40. * fs.writeFile('testfile2', 'test2', callback);
  41. * }
  42. * ]);
  43. *
  44. * // It's possible to pass any number of additional arguments when calling the
  45. * // continuation:
  46. *
  47. * node> var fn = async.apply(sys.puts, 'one');
  48. * node> fn('two', 'three');
  49. * one
  50. * two
  51. * three
  52. */