@yamamotok/dataobject
Version:
Decorator based JSON serializer and deserializer.
16 lines • 777 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomTransformerStrategy = void 0;
const Strategy_1 = require("../Strategy");
class CustomTransformerStrategy extends Strategy_1.Strategy {
transform(opts) {
var _a, _b;
const customFunc = (_b = (_a = opts.options) === null || _a === void 0 ? void 0 : _a.transformer) === null || _b === void 0 ? void 0 : _b.to;
if (customFunc) {
return new Strategy_1.Transformed(customFunc(opts.sourceValue, opts.context, Object.assign(Object.assign({}, opts.options), { key: opts.key })));
}
return undefined;
}
}
exports.CustomTransformerStrategy = CustomTransformerStrategy;
//# sourceMappingURL=CustomTransformerStrategy.js.map