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.

wrapAsync.js 952B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.isAsyncIterable = exports.isAsyncGenerator = exports.isAsync = undefined;
  6. var _asyncify = require('../asyncify');
  7. var _asyncify2 = _interopRequireDefault(_asyncify);
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. function isAsync(fn) {
  10. return fn[Symbol.toStringTag] === 'AsyncFunction';
  11. }
  12. function isAsyncGenerator(fn) {
  13. return fn[Symbol.toStringTag] === 'AsyncGenerator';
  14. }
  15. function isAsyncIterable(obj) {
  16. return typeof obj[Symbol.asyncIterator] === 'function';
  17. }
  18. function wrapAsync(asyncFn) {
  19. if (typeof asyncFn !== 'function') throw new Error('expected a function');
  20. return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn;
  21. }
  22. exports.default = wrapAsync;
  23. exports.isAsync = isAsync;
  24. exports.isAsyncGenerator = isAsyncGenerator;
  25. exports.isAsyncIterable = isAsyncIterable;