Conversation
| if (config.delimiter && (!Array.isArray(config.delimiter) || config.delimiter.some(d => typeof d !== 'string'))) throw new Error('delimiter is not an array of strings'); | ||
| if (config.caches && (!Array.isArray(config.caches) || config.caches.some(d => typeof d?.local === 'undefined' || typeof d?.get !== 'function'))) throw new Error('invalid cache instance'); |
There was a problem hiding this comment.
there seems to be validation of the config object in multiple places, would it make sense to encapsulate that in one place and leveraging type checking?
There was a problem hiding this comment.
the narrative being that if objects are validated at creation, we can assume them valid throughout the runtime
There was a problem hiding this comment.
It does seem that way, though I fear it's because of the polymorphism in the config (Accepting falsey/nullish values when we want to disable a given feature).
I tried to perform all validations and checks that would lead to errors in that file, but I'm open to better ideas. Both in terms of the interface and subsequent checks.
Co-authored-by: Mathieu St-Vincent <6082025+mats852@users.noreply.github.com>
|
Happy new years everyone. I'm happy to keep collecting comments, though I'd really like to merge at some point. I am targeting January 9th unless there is an objection. |
Summary
v5.0.0 RC
Maintenance
files(safer)Minor changes
Breaking changes
cachesis a list of ready-to-use stores and will no longer hydrate as in-memory by default.Merge Checklist