Open mantas-janulionis opened 3 years ago
IMHO the codec should do only the transformation from
string
toArray<string>
then you can easilypipe
to aArray<string> -> Array<number>
codec e.g.arrayFromString.pipe(t.array(NumberFromString))
This is probably a right idea. Thinking about a use case where I would need to convert from string
to Array<string>
, it would require another codec such as StringFromString which is redundant
This is probably a right idea. Thinking about a use case where I would need to convert from
string
toArray<string>
, it would require another codec such as StringFromString which is redundant
Would t.string
not work? string -> string
is a subset of unknown -> string
Generalised implementation of converting string to Array. It is essentially utilising string.split and decoder for each item. It accepts both string and RegExp as split separator. It is compatible with other codecs, thus usage like
ArrayFromString(IntFromString)
is accepted