Skip to content
Snippets Groups Projects
Verified Commit 530e56f7 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: new transformer function concat

parent dc417225
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,7 @@ class Datasource extends Base {
*/
constructor() {
super();
this[internalSymbol] = new ProxyObserver({
options: extend({}, this.defaults),
});
......
......@@ -169,6 +169,13 @@ class RestAPI extends Server {
}
}
/**
* @private
* @param init
* @param key
* @param callback
* @returns {Promise<string>}
*/
function fetchData(init, key, callback) {
const self = this;
let response;
......
......@@ -8,7 +8,7 @@
import {Base} from "../types/base.mjs";
import {getGlobal, getGlobalObject} from "../types/global.mjs";
import {ID} from "../types/id.mjs";
import {isArray, isObject, isString} from "../types/is.mjs";
import {isArray, isObject, isString, isPrimitive} from "../types/is.mjs";
import {getDocumentTranslations, Translations} from "../i18n/translations.mjs";
import {
validateFunction,
......@@ -397,6 +397,28 @@ function transform(value) {
return new Pathfinder(value).exists(key);
case "concat":
let pf2 = new Pathfinder(value);
let concat = "";
while (args.length > 0) {
key = args.shift();
if (key === undefined) {
throw new Error("missing key parameter");
}
if (!pf2.exists(key)) {
concat += key;
continue;
}
let v = pf2.getVia(key);
if(!isPrimitive(v)) {
throw new Error("value is not primitive");
}
concat += v;
}
return concat;
case "path":
key = args.shift();
if (key === undefined) {
......
......@@ -32,12 +32,12 @@
"create-polyfill-service-url": "^2.2.6",
"crypt": "^0.0.2",
"cssnano": "^5.1.15",
"esbuild": "^0.17.8",
"esbuild": "^0.17.10",
"flow-bin": "^0.200.0",
"fs": "0.0.1-security",
"glob": "^8.1.0",
"graphviz": "^0.0.9",
"jsdoc": "^4.0.1",
"jsdoc": "^4.0.2",
"jsdoc-external-example": "github:volker-schukai/jsdoc-external-example",
"jsdoc-plantuml": "^1.0.2",
"jsdom": "^21.1.0",
......@@ -50,7 +50,7 @@
"postcss-import": "^15.1.0",
"postcss-load-config": "^4.0.1",
"postcss-mixins": "^9.0.4",
"postcss-nested": "^6.0.0",
"postcss-nested": "^6.0.1",
"postcss-nesting": "^11.2.1",
"postcss-normalize": "^10.0.1",
"postcss-responsive-type": "^1.0.0",
......@@ -61,11 +61,11 @@
"url": "^0.11.0",
"url-exist": "3.0.1",
"util": "^0.12.5",
"vite": "^4.1.2",
"vite": "^4.1.3",
"vite-plugin-banner": "^0.7.0",
"vite-plugin-list-directory-contents": "^1.4.5",
"vite-plugin-minify": "^1.5.2",
"vite-plugin-mkcert": "^1.13.1",
"vite-plugin-mkcert": "^1.13.2",
"ws": "^8.12.1"
}
}
This diff is collapsed.
......@@ -27,6 +27,7 @@ describe('Transformer', function () {
describe('Transformer.run()', function () {
[
['concat:a.b.c:test:a.b.d', {a: {b: {c: 4, d: 6}}}, "4test6"],
['??:a', null, 'a'],
['??:a', undefined, 'a'],
['??:a', 'true', 'true'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment