@catladder/pipeline 1.169.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>;
@@ -132,7 +132,7 @@ function replaceAsync(string, searchValue, replacer) {
132
132
  case 1:
133
133
  _a.trys.push([1, 3,, 4]);
134
134
  values_1 = [];
135
- String.prototype.replace.call(string.toString(), searchValue, function () {
135
+ String.prototype.replace.call(string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string), searchValue, function () {
136
136
  var args = [];
137
137
  for (var _i = 0; _i < arguments.length; _i++) {
138
138
  args[_i] = arguments[_i];
@@ -148,7 +148,7 @@ function replaceAsync(string, searchValue, replacer) {
148
148
  containsBashExpression = resolvedValues_1.some(function (value) {
149
149
  return value instanceof BashExpression_1.BashExpression;
150
150
  });
151
- result = String.prototype.replace.call(string.toString(), searchValue, function () {
151
+ result = (string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string)).replace(searchValue, function () {
152
152
  var _a, _b;
153
153
  return (_b = (_a = resolvedValues_1.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
154
154
  });