@abaplint/runtime 1.8.26 → 1.8.27
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.
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { ICharacter } from "../types/_character";
|
|
2
|
-
export declare
|
|
2
|
+
export declare type replaceInput = {
|
|
3
|
+
target: ICharacter;
|
|
4
|
+
sectionLength?: ICharacter;
|
|
5
|
+
regex?: ICharacter;
|
|
6
|
+
all: boolean;
|
|
7
|
+
with: ICharacter;
|
|
8
|
+
of: ICharacter;
|
|
9
|
+
};
|
|
10
|
+
export declare function replace(input: replaceInput): void;
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replace = void 0;
|
|
4
|
-
function replace(input
|
|
5
|
-
let temp = input.get();
|
|
4
|
+
function replace(input) {
|
|
5
|
+
let temp = input.target.get();
|
|
6
6
|
let search = "";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
let found = false;
|
|
8
|
+
if (input.of) {
|
|
9
|
+
search = input.of.get();
|
|
10
|
+
if (search.length === 0 && input.all === true) {
|
|
11
|
+
throw "REPLACE, zero length input";
|
|
12
|
+
}
|
|
13
|
+
found = temp.indexOf(search) >= 0;
|
|
9
14
|
}
|
|
10
|
-
else {
|
|
11
|
-
|
|
15
|
+
else if (input.regex) {
|
|
16
|
+
if (input.regex.get().length === 0 && input.all === true) {
|
|
17
|
+
throw "REPLACE, zero length input";
|
|
18
|
+
}
|
|
19
|
+
found = temp.match(search) !== null;
|
|
20
|
+
search = new RegExp(input.regex.get());
|
|
12
21
|
}
|
|
13
22
|
let replace = "";
|
|
14
|
-
if (typeof
|
|
15
|
-
replace =
|
|
23
|
+
if (typeof input.with === "string") {
|
|
24
|
+
replace = input.with;
|
|
16
25
|
}
|
|
17
26
|
else {
|
|
18
|
-
replace =
|
|
27
|
+
replace = input.with.get();
|
|
19
28
|
}
|
|
20
|
-
|
|
21
|
-
if (all === true) {
|
|
22
|
-
if (search.length === 0) {
|
|
23
|
-
throw "REPLACE, zero length input";
|
|
24
|
-
}
|
|
29
|
+
if (input.all === true) {
|
|
25
30
|
while (temp.replace(search, replace) !== temp) {
|
|
26
31
|
temp = temp.replace(search, replace);
|
|
27
32
|
}
|
|
@@ -32,7 +37,7 @@ function replace(input, all, s, r) {
|
|
|
32
37
|
const subrc = found ? 0 : 4;
|
|
33
38
|
// @ts-ignore
|
|
34
39
|
abap.builtin.sy.get().subrc.set(subrc);
|
|
35
|
-
input.set(temp);
|
|
40
|
+
input.target.set(temp);
|
|
36
41
|
}
|
|
37
42
|
exports.replace = replace;
|
|
38
43
|
//# sourceMappingURL=replace.js.map
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"description": "Transpiler - Runtime",
|
|
5
|
-
"main": "build/src/index.js",
|
|
6
|
-
"typings": "build/src/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"compile": "tsc",
|
|
13
|
-
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
-
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
-
"test": "npm run compile && mocha"
|
|
16
|
-
},
|
|
17
|
-
"mocha": {
|
|
18
|
-
"recursive": true,
|
|
19
|
-
"reporter": "progress",
|
|
20
|
-
"spec": "build/test/**/*.js",
|
|
21
|
-
"require": "source-map-support/register"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"ABAP",
|
|
25
|
-
"abaplint"
|
|
26
|
-
],
|
|
27
|
-
"author": "abaplint",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"hdb": "^0.19.1",
|
|
31
|
-
"sql.js": "^1.6.2"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/chai": "^4.3.0",
|
|
35
|
-
"@types/mocha": "^9.1.0",
|
|
36
|
-
"@types/sql.js": "^1.4.3",
|
|
37
|
-
"chai": "^4.3.6",
|
|
38
|
-
"mocha": "^9.2.2",
|
|
39
|
-
"source-map-support": "^0.5.21",
|
|
40
|
-
"typescript": "^4.6.3"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abaplint/runtime",
|
|
3
|
+
"version": "1.8.27",
|
|
4
|
+
"description": "Transpiler - Runtime",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"typings": "build/src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"compile": "tsc",
|
|
13
|
+
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
+
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
+
"test": "npm run compile && mocha"
|
|
16
|
+
},
|
|
17
|
+
"mocha": {
|
|
18
|
+
"recursive": true,
|
|
19
|
+
"reporter": "progress",
|
|
20
|
+
"spec": "build/test/**/*.js",
|
|
21
|
+
"require": "source-map-support/register"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ABAP",
|
|
25
|
+
"abaplint"
|
|
26
|
+
],
|
|
27
|
+
"author": "abaplint",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"hdb": "^0.19.1",
|
|
31
|
+
"sql.js": "^1.6.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/chai": "^4.3.0",
|
|
35
|
+
"@types/mocha": "^9.1.0",
|
|
36
|
+
"@types/sql.js": "^1.4.3",
|
|
37
|
+
"chai": "^4.3.6",
|
|
38
|
+
"mocha": "^9.2.2",
|
|
39
|
+
"source-map-support": "^0.5.21",
|
|
40
|
+
"typescript": "^4.6.3"
|
|
41
|
+
}
|
|
42
|
+
}
|