@itrocks/core-transformers 0.0.16 → 0.1.0
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.
- package/cjs/container.js +17 -1
- package/esm/container.js +18 -2
- package/package.json +2 -1
package/cjs/container.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HtmlContainer = void 0;
|
|
4
4
|
exports.initContainerTransformers = initContainerTransformers;
|
|
5
5
|
const transformer_1 = require("@itrocks/transformer");
|
|
6
|
+
const transformer_2 = require("@itrocks/transformer");
|
|
6
7
|
class HtmlContainer {
|
|
7
8
|
mandatoryContainer;
|
|
8
9
|
container;
|
|
@@ -13,6 +14,21 @@ class HtmlContainer {
|
|
|
13
14
|
}
|
|
14
15
|
exports.HtmlContainer = HtmlContainer;
|
|
15
16
|
function initContainerTransformers() {
|
|
16
|
-
(0,
|
|
17
|
+
(0, transformer_2.setFormatTransformer)(transformer_1.HTML, (value, askFor) => {
|
|
18
|
+
if (!(askFor.container && askFor.mandatoryContainer)) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if ((typeof (value) === 'object') && value.toString) {
|
|
22
|
+
const valueString = value.toString();
|
|
23
|
+
for (const propertyName in value) {
|
|
24
|
+
const propertyValue = value[propertyName];
|
|
25
|
+
if (((typeof propertyValue)[0] === 's') && (propertyValue === valueString)) {
|
|
26
|
+
value[propertyName] = '<div>' + propertyValue + '</div>';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
return '<div>' + value + '</div>';
|
|
32
|
+
});
|
|
17
33
|
}
|
|
18
34
|
//# sourceMappingURL=container.js.map
|
package/esm/container.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { HTML
|
|
1
|
+
import { HTML } from '@itrocks/transformer';
|
|
2
|
+
import { setFormatTransformer } from '@itrocks/transformer';
|
|
2
3
|
export class HtmlContainer {
|
|
3
4
|
mandatoryContainer;
|
|
4
5
|
container;
|
|
@@ -8,6 +9,21 @@ export class HtmlContainer {
|
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export function initContainerTransformers() {
|
|
11
|
-
setFormatTransformer(HTML, (value, askFor) =>
|
|
12
|
+
setFormatTransformer(HTML, (value, askFor) => {
|
|
13
|
+
if (!(askFor.container && askFor.mandatoryContainer)) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if ((typeof (value) === 'object') && value.toString) {
|
|
17
|
+
const valueString = value.toString();
|
|
18
|
+
for (const propertyName in value) {
|
|
19
|
+
const propertyValue = value[propertyName];
|
|
20
|
+
if (((typeof propertyValue)[0] === 's') && (propertyValue === valueString)) {
|
|
21
|
+
value[propertyName] = '<div>' + propertyValue + '</div>';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
return '<div>' + value + '</div>';
|
|
27
|
+
});
|
|
12
28
|
}
|
|
13
29
|
//# sourceMappingURL=container.js.map
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"@itrocks/composition": "latest",
|
|
8
8
|
"@itrocks/storage": "latest",
|
|
9
9
|
"@itrocks/class-type": "latest",
|
|
10
|
+
"@itrocks/precision": "latest",
|
|
10
11
|
"@itrocks/property-type": "latest",
|
|
11
12
|
"@itrocks/reflect": "latest",
|
|
12
13
|
"@itrocks/transformer": "latest"
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"build:esm": "tsc -p tsconfig.esm.json && node esm/esm"
|
|
49
50
|
},
|
|
50
51
|
"types": "./esm/core-transformers.d.ts",
|
|
51
|
-
"version": "0.0
|
|
52
|
+
"version": "0.1.0"
|
|
52
53
|
}
|