Good morning
Good Morning!
¡månmån!
Morning
👋
morning
morning
Morn' 😃...
was just reading the source code of a lib we depend on p heavily
and maybe i'm feeling @dominicm 's rage at js today
what's the guilty lib @alex.lynham?
some real 'wow okay, you didn't need to reimplement that' moments
the js jsonschema impl
some highlights
https://github.com/tdegrunt/jsonschema/blob/8bbf2c4e10c2290535f41ac9347f361649976745/lib/helpers.js#L228 ^ where instead of using the ok lodash or excellent ramda libs, they reimplement a bunch of merging utils
https://github.com/tdegrunt/jsonschema/blob/8bbf2c4e10c2290535f41ac9347f361649976745/lib/helpers.js#L116 ^ where there's a random set of regexes when there are libs that cover the RFC regexes (admittedly this one isn't so bad, but I do have to trust them, as they're pretty hard to visually parse)
and this lovely bit of code, which was the source of a bug AFAICT https://github.com/tdegrunt/jsonschema/blob/8bbf2c4e10c2290535f41ac9347f361649976745/lib/validator.js#L202 there's so much mutation going on it's hard to tell what's happening, plus loads of OO misdirection
i worked it out in the end but HOO BOY
been meaning to look at switching to the ajv
lib and this has just accelerated that
Have used ajv, experience was mostly good. Performance wasn't great, but I suspect that is down to the size of our schema.