@itrocks/core-transformers 0.0.17 → 0.1.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.
@@ -88,10 +88,10 @@ async function collectionOutput(values, object, property, askFor) {
88
88
  return '<ul>'
89
89
  + (await Promise.all(values.map(async (object) => '<li>'
90
90
  + (await depends.representativeValueOf(object))
91
- + '</li>'))).join('')
91
+ + '</li>'))).sort().join('')
92
92
  + '</ul>';
93
93
  }
94
- return (await Promise.all(values.map(object => depends.representativeValueOf(object)))).join(', ');
94
+ return (await Promise.all(values.map(object => depends.representativeValueOf(object)))).sort().join(', ');
95
95
  }
96
96
  function initCollectionHtmlTransformers(dependencies = {}) {
97
97
  Object.assign(depends, dependencies);
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, transformer_1.setFormatTransformer)(transformer_1.HTML, (value, askFor) => (askFor.container && askFor.mandatoryContainer) ? ('<div>' + value + '</div>') : value);
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
@@ -84,10 +84,10 @@ async function collectionOutput(values, object, property, askFor) {
84
84
  return '<ul>'
85
85
  + (await Promise.all(values.map(async (object) => '<li>'
86
86
  + (await depends.representativeValueOf(object))
87
- + '</li>'))).join('')
87
+ + '</li>'))).sort().join('')
88
88
  + '</ul>';
89
89
  }
90
- return (await Promise.all(values.map(object => depends.representativeValueOf(object)))).join(', ');
90
+ return (await Promise.all(values.map(object => depends.representativeValueOf(object)))).sort().join(', ');
91
91
  }
92
92
  export function initCollectionHtmlTransformers(dependencies = {}) {
93
93
  Object.assign(depends, dependencies);
package/esm/container.js CHANGED
@@ -1,4 +1,5 @@
1
- import { HTML, setFormatTransformer } from '@itrocks/transformer';
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) => (askFor.container && askFor.mandatoryContainer) ? ('<div>' + value + '</div>') : value);
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
@@ -49,5 +49,5 @@
49
49
  "build:esm": "tsc -p tsconfig.esm.json && node esm/esm"
50
50
  },
51
51
  "types": "./esm/core-transformers.d.ts",
52
- "version": "0.0.17"
52
+ "version": "0.1.1"
53
53
  }