rubenwardy,
@rubenwardy@fosstodon.org avatar

@Korny

The former seems unnecessarily obtuse, what's the reason for it? Surely it's not performance given how many function calls you're adding

Tangentially related, but I'm thinking of Zod now. It's a library that allows you to define a schema and parse untrusted data. You can convert types and perform processing on individual fields. It's much more readable than your mapper

z.object({  
 date: z.date(),  
 count: z.coerce.number(),  
 thing: z.preprocess(x => x+2, z.number())  
})  
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • everett
  • tacticalgear
  • magazineikmin
  • thenastyranch
  • rosin
  • tester
  • Youngstown
  • khanakhh
  • slotface
  • ngwrru68w68
  • kavyap
  • mdbf
  • InstantRegret
  • JUstTest
  • osvaldo12
  • GTA5RPClips
  • ethstaker
  • normalnudes
  • Durango
  • cisconetworking
  • anitta
  • modclub
  • cubers
  • Leos
  • provamag3
  • megavids
  • lostlight
  • All magazines