UNPKG

fashion-model

Version:

JavaScript library for defining types and their properties with support for wrapping/unwrapping and serialization/deserialization.

16 lines (14 loc) 372 B
module.exports = require('./Model').extend({ typeName: 'string', wrap: false, coerce: function (value, options) { if (options.strict) { // strict mode if ((value != null) && (value.constructor !== String)) { this.coercionError(value, options); } return value; } return (value == null) ? value : value.toString(); } });