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.

bind.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. function _jestUtil() {
  7. const data = require('jest-util');
  8. _jestUtil = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. var _array = _interopRequireDefault(require('./table/array'));
  14. var _template = _interopRequireDefault(require('./table/template'));
  15. var _validation = require('./validation');
  16. function _interopRequireDefault(obj) {
  17. return obj && obj.__esModule ? obj : {default: obj};
  18. }
  19. /**
  20. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  21. *
  22. * This source code is licensed under the MIT license found in the
  23. * LICENSE file in the root directory of this source tree.
  24. *
  25. */
  26. var _default =
  27. (cb, supportsDone = true) =>
  28. (table, ...taggedTemplateData) =>
  29. function eachBind(title, test, timeout) {
  30. try {
  31. const tests = isArrayTable(taggedTemplateData)
  32. ? buildArrayTests(title, table)
  33. : buildTemplateTests(title, table, taggedTemplateData);
  34. return tests.forEach(row =>
  35. cb(
  36. row.title,
  37. applyArguments(supportsDone, row.arguments, test),
  38. timeout
  39. )
  40. );
  41. } catch (e) {
  42. const error = new (_jestUtil().ErrorWithStack)(e.message, eachBind);
  43. return cb(title, () => {
  44. throw error;
  45. });
  46. }
  47. };
  48. exports.default = _default;
  49. const isArrayTable = data => data.length === 0;
  50. const buildArrayTests = (title, table) => {
  51. (0, _validation.validateArrayTable)(table);
  52. return (0, _array.default)(title, table);
  53. };
  54. const buildTemplateTests = (title, table, taggedTemplateData) => {
  55. const headings = getHeadingKeys(table[0]);
  56. (0, _validation.validateTemplateTableArguments)(headings, taggedTemplateData);
  57. return (0, _template.default)(title, headings, taggedTemplateData);
  58. };
  59. const getHeadingKeys = headings =>
  60. (0, _validation.extractValidTemplateHeadings)(headings)
  61. .replace(/\s/g, '')
  62. .split('|');
  63. const applyArguments = (supportsDone, params, test) =>
  64. supportsDone && params.length < test.length
  65. ? done => test(...params, done)
  66. : () => test(...params);