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.

normalizeDiffOptions.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.normalizeDiffOptions = exports.noColor = void 0;
  6. var _chalk = _interopRequireDefault(require('chalk'));
  7. function _interopRequireDefault(obj) {
  8. return obj && obj.__esModule ? obj : {default: obj};
  9. }
  10. /**
  11. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  12. *
  13. * This source code is licensed under the MIT license found in the
  14. * LICENSE file in the root directory of this source tree.
  15. */
  16. const noColor = string => string;
  17. exports.noColor = noColor;
  18. const DIFF_CONTEXT_DEFAULT = 5;
  19. const OPTIONS_DEFAULT = {
  20. aAnnotation: 'Expected',
  21. aColor: _chalk.default.green,
  22. aIndicator: '-',
  23. bAnnotation: 'Received',
  24. bColor: _chalk.default.red,
  25. bIndicator: '+',
  26. changeColor: _chalk.default.inverse,
  27. changeLineTrailingSpaceColor: noColor,
  28. commonColor: _chalk.default.dim,
  29. commonIndicator: ' ',
  30. commonLineTrailingSpaceColor: noColor,
  31. contextLines: DIFF_CONTEXT_DEFAULT,
  32. emptyFirstOrLastLinePlaceholder: '',
  33. expand: true,
  34. includeChangeCounts: false,
  35. omitAnnotationLines: false,
  36. patchColor: _chalk.default.yellow
  37. };
  38. const getContextLines = contextLines =>
  39. typeof contextLines === 'number' &&
  40. Number.isSafeInteger(contextLines) &&
  41. contextLines >= 0
  42. ? contextLines
  43. : DIFF_CONTEXT_DEFAULT; // Pure function returns options with all properties.
  44. const normalizeDiffOptions = (options = {}) => ({
  45. ...OPTIONS_DEFAULT,
  46. ...options,
  47. contextLines: getContextLines(options.contextLines)
  48. });
  49. exports.normalizeDiffOptions = normalizeDiffOptions;