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.

createTester.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = _createTester;
  6. var _breakLoop = require('./breakLoop');
  7. var _breakLoop2 = _interopRequireDefault(_breakLoop);
  8. var _wrapAsync = require('./wrapAsync');
  9. var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. function _createTester(check, getResult) {
  12. return (eachfn, arr, _iteratee, cb) => {
  13. var testPassed = false;
  14. var testResult;
  15. const iteratee = (0, _wrapAsync2.default)(_iteratee);
  16. eachfn(arr, (value, _, callback) => {
  17. iteratee(value, (err, result) => {
  18. if (err || err === false) return callback(err);
  19. if (check(result) && !testResult) {
  20. testPassed = true;
  21. testResult = getResult(true, value);
  22. return callback(null, _breakLoop2.default);
  23. }
  24. callback();
  25. });
  26. }, err => {
  27. if (err) return cb(err);
  28. cb(null, testPassed ? testResult : getResult(false));
  29. });
  30. };
  31. }
  32. module.exports = exports['default'];