A
arktype•4d ago
frolic

built-in stringify morphs

I see that there's built-in string parsing morphs, like string.integer.parse, but are there similar ones for the other way? e.g. number.integer.stringify
2 Replies
frolic
frolicOP•4d ago
I also see prior art with object.json.stringify (to match string.json.parse)
ssalbdivad
ssalbdivad•4d ago
Yeah trying to remember my thinking around not adding that initially. I think the idea was a lot of things can be stringified without any special logic whereas stuff like object.json or string.integer have meaningful restrictions that apply to the transformation Still may be worthwhile to add especially for a case like that though. Probably just wanted to be sure there wasn't some common API, but even if I'm using the same function internally, have it available under the corresponding primitive type is a nice convenience. Feel free to make a PR if you'd like- probably about the most straightforward issue to implement without knowing much about the repo 😊

Did you find this page helpful?