custom-class-validator-tools 1.1.1 → 1.1.2

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.
@@ -31,7 +31,11 @@ const FO = __importStar(require("fp-ts/Option"));
31
31
  const ToNumberArray = () => {
32
32
  const toPlain = (0, class_transformer_1.Transform)(({ value }) => value, { toPlainOnly: true });
33
33
  const toClass = (target, key) => (0, class_transformer_1.Transform)(({ obj }) => {
34
- return FF.pipe(obj[key], FO.fromPredicate(predicate => Array.isArray(predicate)), FO.fold(() => obj[key], items => {
34
+ return FF.pipe(obj[key], FO.fromPredicate(predicate => Array.isArray(predicate)), FO.fold(() => {
35
+ return FF.pipe(Number(obj[key]), FO.fromPredicate(value => (0, is_boolean_1.isFalse)(Number.isNaN(value))), FO.fold(() => {
36
+ return obj[key];
37
+ }, right => [right]));
38
+ }, items => {
35
39
  const result = items.map(item => +item);
36
40
  return FF.pipe(result, FO.fromPredicate(values => values.some(item => (0, is_boolean_1.isTrue)(Number.isNaN(item)))), FO.fold(() => result, () => obj[key]));
37
41
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "custom-class-validator-tools",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",