task.js 238 B

12345678910111213141516
  1. 'use strict';
  2. function task(name, fn) {
  3. if (typeof name === 'function') {
  4. fn = name;
  5. name = fn.displayName || fn.name;
  6. }
  7. if (!fn) {
  8. return this._getTask(name);
  9. }
  10. this._setTask(name, fn);
  11. }
  12. module.exports = task;