parse-js
Version:
Utility library for object structure conversion.
22 lines (16 loc) • 545 B
JavaScript
;
function ConstantTransformer(value) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!(this instanceof ConstantTransformer)) {
return this.transform(new ConstantTransformer(value, options));
}
this._value = value;
this._reverseValue = options.reverseValue || value;
}
ConstantTransformer.prototype.parse = function () {
return this._value;
};
ConstantTransformer.prototype.reverse = function () {
return this._reverseValue;
};
module.exports = ConstantTransformer;