Closed silfverstrom closed 9 years ago
Started implementing a formatter for returning singleValues but then I realized that it would be pretty weird.
What will happen when you have a .returns and a .itemsReturns. Something needs to be run first? Won't that be more confusing than useful? If you want to reuse some formatter that is implemented on singleValues you could simply do something like:
var schema = Duns.string().returns((val) => val + '!');
Duns.array().returns((val) => {
return schema.init(val).format();
}).format();
Alternatively you could do something like,
Duns.array().returns(Duns.item().string());
/// Where .item wraps everything in a map function?
@br0r
Realized that my example won't actually work. Perhaps .item
could be a solution. Would be kind of nice to use it with formatters later on. Perhaps should wait with this functionality until we deal with the default formatters?
This allows for more powerful expressions, returning part of a array etc. There should also be a formatter that returns single values,