@yamamotok/dataobject
Version:
Decorator based JSON serializer and deserializer.
18 lines • 606 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrimitiveStrategy = void 0;
const Strategy_1 = require("../Strategy");
class PrimitiveStrategy extends Strategy_1.Strategy {
transform(opts) {
const type = typeof opts.sourceValue;
switch (type) {
case 'boolean':
case 'number':
case 'string':
return new Strategy_1.Transformed(opts.sourceValue);
}
return undefined;
}
}
exports.PrimitiveStrategy = PrimitiveStrategy;
//# sourceMappingURL=PrimitiveStrategy.js.map