aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js
diff options
context:
space:
mode:
authorNevena Bojovic <nenabojov@gmail.com>2022-03-01 22:05:25 +0100
committerNevena Bojovic <nenabojov@gmail.com>2022-03-01 22:05:25 +0100
commit6555fb80fdd8f6a5d201efadec3189d1244830a0 (patch)
treec1aa1c5aedc634ad1ea7fad4847884d559b51290 /sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js
parent7d3640f824f46490b47bd95f1c5a16644f712068 (diff)
Izbrisala bin, obj i node-modules.
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js121
1 files changed, 0 insertions, 121 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js b/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js
deleted file mode 100644
index a1fbdde7..00000000
--- a/sandbox/testAppNevena/Front/node_modules/@schematics/angular/utility/change.js
+++ /dev/null
@@ -1,121 +0,0 @@
-"use strict";
-/**
- * @license
- * Copyright Google LLC All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.applyToUpdateRecorder = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = void 0;
-/**
- * An operation that does nothing.
- */
-class NoopChange {
- constructor() {
- this.description = 'No operation.';
- this.order = Infinity;
- this.path = null;
- }
- apply() {
- return Promise.resolve();
- }
-}
-exports.NoopChange = NoopChange;
-/**
- * Will add text to the source code.
- */
-class InsertChange {
- constructor(path, pos, toAdd) {
- this.path = path;
- this.pos = pos;
- this.toAdd = toAdd;
- if (pos < 0) {
- throw new Error('Negative positions are invalid');
- }
- this.description = `Inserted ${toAdd} into position ${pos} of ${path}`;
- this.order = pos;
- }
- /**
- * This method does not insert spaces if there is none in the original string.
- */
- apply(host) {
- return host.read(this.path).then((content) => {
- const prefix = content.substring(0, this.pos);
- const suffix = content.substring(this.pos);
- return host.write(this.path, `${prefix}${this.toAdd}${suffix}`);
- });
- }
-}
-exports.InsertChange = InsertChange;
-/**
- * Will remove text from the source code.
- */
-class RemoveChange {
- constructor(path, pos, toRemove) {
- this.path = path;
- this.pos = pos;
- this.toRemove = toRemove;
- if (pos < 0) {
- throw new Error('Negative positions are invalid');
- }
- this.description = `Removed ${toRemove} into position ${pos} of ${path}`;
- this.order = pos;
- }
- apply(host) {
- return host.read(this.path).then((content) => {
- const prefix = content.substring(0, this.pos);
- const suffix = content.substring(this.pos + this.toRemove.length);
- // TODO: throw error if toRemove doesn't match removed string.
- return host.write(this.path, `${prefix}${suffix}`);
- });
- }
-}
-exports.RemoveChange = RemoveChange;
-/**
- * Will replace text from the source code.
- */
-class ReplaceChange {
- constructor(path, pos, oldText, newText) {
- this.path = path;
- this.pos = pos;
- this.oldText = oldText;
- this.newText = newText;
- if (pos < 0) {
- throw new Error('Negative positions are invalid');
- }
- this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`;
- this.order = pos;
- }
- apply(host) {
- return host.read(this.path).then((content) => {
- const prefix = content.substring(0, this.pos);
- const suffix = content.substring(this.pos + this.oldText.length);
- const text = content.substring(this.pos, this.pos + this.oldText.length);
- if (text !== this.oldText) {
- return Promise.reject(new Error(`Invalid replace: "${text}" != "${this.oldText}".`));
- }
- // TODO: throw error if oldText doesn't match removed string.
- return host.write(this.path, `${prefix}${this.newText}${suffix}`);
- });
- }
-}
-exports.ReplaceChange = ReplaceChange;
-function applyToUpdateRecorder(recorder, changes) {
- for (const change of changes) {
- if (change instanceof InsertChange) {
- recorder.insertLeft(change.pos, change.toAdd);
- }
- else if (change instanceof RemoveChange) {
- recorder.remove(change.order, change.toRemove.length);
- }
- else if (change instanceof ReplaceChange) {
- recorder.remove(change.order, change.oldText.length);
- recorder.insertLeft(change.order, change.newText);
- }
- else if (!(change instanceof NoopChange)) {
- throw new Error('Unknown Change type encountered when updating a recorder.');
- }
- }
-}
-exports.applyToUpdateRecorder = applyToUpdateRecorder;