Hacker News new | ask | show | jobs
by davidzweig 1369 days ago
We do it like this: https://imgur.com/a/AdeRncw

Just a simple function (ensureType) that checks primitive types (angle brackets for min length). You reconstruct the object using ensureType, writing it back into itself. EnsureType returns what is passed in, with the corresponding type. Has worked well.