@catladder/pipeline 1.170.0 → 1.170.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ export declare class BashExpression {
8
8
  constructor(value: string | BashExpression);
9
9
  toJSON(): string;
10
10
  toString(): string;
11
+ replace(searchValue: any, replacer: (substring: string, ...args: any[]) => string): BashExpression;
11
12
  /**
12
13
  *
13
14
  * @returns a bash expression to lowercase the string
@@ -50,6 +50,9 @@ var BashExpression = /** @class */function () {
50
50
  BashExpression.prototype.toString = function () {
51
51
  return this.value.toString();
52
52
  };
53
+ BashExpression.prototype.replace = function (searchValue, replacer) {
54
+ return new BashExpression(this.value.toString().replace(searchValue, replacer));
55
+ };
53
56
  /**
54
57
  *
55
58
  * @returns a bash expression to lowercase the string
@@ -1,2 +1,2 @@
1
1
  import { BashExpression } from "./BashExpression";
2
- export default function replaceAsync(string: string | BashExpression, searchValue: any, replacer: (substring: string, ...args: any[]) => Promise<string | BashExpression>): Promise<string | BashExpression>;
2
+ export default function replaceAsync(string: string | BashExpression, searchValue: any, replacer: (substring: string, ...args: any[]) => Promise<string | BashExpression>): Promise<any>;
@@ -123,17 +123,16 @@ var BashExpression_1 = require("./BashExpression");
123
123
  // and adjusted a bit
124
124
  function replaceAsync(string, searchValue, replacer) {
125
125
  return __awaiter(this, void 0, void 0, function () {
126
- var wasBashExpression, stringRepresentation, values_1, resolvedValues_1, containsBashExpression, result, error_1;
126
+ var wasBashExpression, values_1, resolvedValues_1, containsBashExpression, result, error_1;
127
127
  return __generator(this, function (_a) {
128
128
  switch (_a.label) {
129
129
  case 0:
130
130
  wasBashExpression = string instanceof BashExpression_1.BashExpression;
131
- stringRepresentation = wasBashExpression ? string.toString() : (0, BashExpression_1.bashEscape)(string);
132
131
  _a.label = 1;
133
132
  case 1:
134
133
  _a.trys.push([1, 3,, 4]);
135
134
  values_1 = [];
136
- String.prototype.replace.call(stringRepresentation, searchValue, function () {
135
+ String.prototype.replace.call(string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string), searchValue, function () {
137
136
  var args = [];
138
137
  for (var _i = 0; _i < arguments.length; _i++) {
139
138
  args[_i] = arguments[_i];
@@ -149,7 +148,7 @@ function replaceAsync(string, searchValue, replacer) {
149
148
  containsBashExpression = resolvedValues_1.some(function (value) {
150
149
  return value instanceof BashExpression_1.BashExpression;
151
150
  });
152
- result = String.prototype.replace.call(stringRepresentation, searchValue, function () {
151
+ result = (string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string)).replace(searchValue, function () {
153
152
  var _a, _b;
154
153
  return (_b = (_a = resolvedValues_1.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
155
154
  });