@intelligo.ai/object-to-schema
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -36,3 +36,3 @@ "use strict"; | ||
if (typeof value == 'string') { | ||
return _b = (_a = JSON.parse(value)) === null || _a === void 0 ? void 0 : _a.example, (_b !== null && _b !== void 0 ? _b : typeToRandomData((_d = (_c = JSON.parse(value)) === null || _c === void 0 ? void 0 : _c.type, (_d !== null && _d !== void 0 ? _d : '')))); | ||
return (_b = (_a = JSON.parse(value)) === null || _a === void 0 ? void 0 : _a.example) !== null && _b !== void 0 ? _b : typeToRandomData((_d = (_c = JSON.parse(value)) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : ''); | ||
} | ||
@@ -42,5 +42,5 @@ else if (Array.isArray(value)) { | ||
? [ | ||
(_f = (_e = JSON.parse(value[0])) === null || _e === void 0 ? void 0 : _e.example, (_f !== null && _f !== void 0 ? _f : typeToRandomData((_h = (_g = JSON.parse(value[0])) === null || _g === void 0 ? void 0 : _g.type, (_h !== null && _h !== void 0 ? _h : ''))))) | ||
(_f = (_e = JSON.parse(value[0])) === null || _e === void 0 ? void 0 : _e.example) !== null && _f !== void 0 ? _f : typeToRandomData((_h = (_g = JSON.parse(value[0])) === null || _g === void 0 ? void 0 : _g.type) !== null && _h !== void 0 ? _h : '') | ||
] | ||
: [extractExampleFromSchema((_j = value[0], (_j !== null && _j !== void 0 ? _j : {})))]; | ||
: [extractExampleFromSchema((_j = value[0]) !== null && _j !== void 0 ? _j : {})]; | ||
} | ||
@@ -47,0 +47,0 @@ else if (({}).constructor === value.constructor) { |
@@ -131,6 +131,6 @@ "use strict"; | ||
.reduceRight(function (finalValue, predefinedTransformation) { | ||
var _a, _b, _c, _d; | ||
var transformationName = (_a = predefinedTransformation) === null || _a === void 0 ? void 0 : _a.transformation; | ||
var transformationArgs = (_c = (_b = predefinedTransformation) === null || _b === void 0 ? void 0 : _b.transformationArgs, (_c !== null && _c !== void 0 ? _c : undefined)); | ||
return (_d = predefinedTransformations_1.strategies.predefinedTransformations[transformationName], (_d !== null && _d !== void 0 ? _d : generalUtil_1.identity))(finalValue, transformationArgs); | ||
var _a, _b; | ||
var transformationName = predefinedTransformation === null || predefinedTransformation === void 0 ? void 0 : predefinedTransformation.transformation; | ||
var transformationArgs = (_a = predefinedTransformation === null || predefinedTransformation === void 0 ? void 0 : predefinedTransformation.transformationArgs) !== null && _a !== void 0 ? _a : undefined; | ||
return ((_b = predefinedTransformations_1.strategies.predefinedTransformations[transformationName]) !== null && _b !== void 0 ? _b : generalUtil_1.identity)(finalValue, transformationArgs); | ||
}, valueToSet); | ||
@@ -137,0 +137,0 @@ } |
declare function fromTracerDate(tracerDate: number): string | undefined; | ||
declare function tracerPropertyDocumentType(documentType: string): any; | ||
declare function tracerPropertyTransferType(documentType: string): any; | ||
declare function dateToYear(date: string): number | undefined; | ||
declare function companyAddressType(addressType: string): any; | ||
@@ -17,2 +18,3 @@ export declare const strategies: { | ||
companyAddressType: typeof companyAddressType; | ||
dateToYear: typeof dateToYear; | ||
}; | ||
@@ -19,0 +21,0 @@ }; |
@@ -65,2 +65,8 @@ "use strict"; | ||
} | ||
function dateToYear(date) { | ||
if (!date || !new Date(date).getFullYear()) { | ||
return; | ||
} | ||
return new Date(date).getFullYear(); | ||
} | ||
function companyAddressType(addressType) { | ||
@@ -97,5 +103,6 @@ var value; | ||
tracerPropertyTransferType: tracerPropertyTransferType, | ||
companyAddressType: companyAddressType | ||
companyAddressType: companyAddressType, | ||
dateToYear: dateToYear | ||
} | ||
}; | ||
//# sourceMappingURL=predefinedTransformations.js.map |
@@ -123,3 +123,3 @@ "use strict"; | ||
function sortTransformsByPriority(transforms) { | ||
return ramda_1.default.sort(function (ta, tb) { var _a, _b, _c, _d; return (_b = (_a = ta.target) === null || _a === void 0 ? void 0 : _a.priority, (_b !== null && _b !== void 0 ? _b : 1000)) - (_d = (_c = tb.target) === null || _c === void 0 ? void 0 : _c.priority, (_d !== null && _d !== void 0 ? _d : 1000)); }, transforms); | ||
return ramda_1.default.sort(function (ta, tb) { var _a, _b, _c, _d; return ((_b = (_a = ta.target) === null || _a === void 0 ? void 0 : _a.priority) !== null && _b !== void 0 ? _b : 1000) - ((_d = (_c = tb.target) === null || _c === void 0 ? void 0 : _c.priority) !== null && _d !== void 0 ? _d : 1000); }, transforms); | ||
} | ||
@@ -126,0 +126,0 @@ exports.sortTransformsByPriority = sortTransformsByPriority; |
{ | ||
"name": "@intelligo.ai/object-to-schema", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "", | ||
@@ -8,2 +8,4 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "npx tsc", | ||
"prepublish": "npm run build", | ||
"test": "jest" | ||
@@ -28,2 +30,2 @@ }, | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
344413
6702