source: trip-planner-front/node_modules/@angular/cdk/schematics/update-tool/version-changes.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.2 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.getAllChanges = exports.getChangesForTarget = void 0;
11const target_version_1 = require("./target-version");
12/**
13 * Gets the changes for a given target version from the specified version changes object.
14 *
15 * For readability and a good overview of breaking changes, the version change data always
16 * includes the related Pull Request link. Since this data is not needed when performing the
17 * upgrade, this unused data can be removed and the changes data can be flattened into an
18 * easy iterable array.
19 */
20function getChangesForTarget(target, data) {
21 if (!data) {
22 const version = target_version_1.TargetVersion[target];
23 throw new Error(`No data could be found for target version: ${version}`);
24 }
25 return (data[target] || []).reduce((result, prData) => result.concat(prData.changes), []);
26}
27exports.getChangesForTarget = getChangesForTarget;
28/**
29 * Gets all changes from the specified version changes object. This is helpful in case a migration
30 * rule does not distinguish data based on the target version, but for readability the
31 * upgrade data is separated for each target version.
32 */
33function getAllChanges(data) {
34 return Object.keys(data)
35 .map(targetVersion => getChangesForTarget(targetVersion, data))
36 .reduce((result, versionData) => result.concat(versionData), []);
37}
38exports.getAllChanges = getAllChanges;
39//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi1jaGFuZ2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9zY2hlbWF0aWNzL3VwZGF0ZS10b29sL3ZlcnNpb24tY2hhbmdlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOzs7QUFFSCxxREFBK0M7QUFhL0M7Ozs7Ozs7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