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.

doUntil.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = doUntil;
  6. var _doWhilst = require('./doWhilst');
  7. var _doWhilst2 = _interopRequireDefault(_doWhilst);
  8. var _wrapAsync = require('./internal/wrapAsync');
  9. var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. /**
  12. * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
  13. * argument ordering differs from `until`.
  14. *
  15. * @name doUntil
  16. * @static
  17. * @memberOf module:ControlFlow
  18. * @method
  19. * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
  20. * @category Control Flow
  21. * @param {AsyncFunction} iteratee - An async function which is called each time
  22. * `test` fails. Invoked with (callback).
  23. * @param {AsyncFunction} test - asynchronous truth test to perform after each
  24. * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
  25. * non-error args from the previous callback of `iteratee`
  26. * @param {Function} [callback] - A callback which is called after the test
  27. * function has passed and repeated execution of `iteratee` has stopped. `callback`
  28. * will be passed an error and any arguments passed to the final `iteratee`'s
  29. * callback. Invoked with (err, [results]);
  30. * @returns {Promise} a promise, if no callback is passed
  31. */
  32. function doUntil(iteratee, test, callback) {
  33. const _test = (0, _wrapAsync2.default)(test);
  34. return (0, _doWhilst2.default)(iteratee, (...args) => {
  35. const cb = args.pop();
  36. _test(...args, (err, truth) => cb(err, !truth));
  37. }, callback);
  38. }
  39. module.exports = exports['default'];