BKWLD / cloak-utils

Shared utility functions for Cloak packages.
MIT License
0 stars 0 forks source link

Add a custom defaultsDeep that replaces arrays rather than merge them #3

Open weotch opened 2 years ago

weotch commented 2 years ago

See

Also, from https://stackoverflow.com/a/33247597/59160

image

weotch commented 2 years ago

I can use this to refactor code like this: https://github.com/BKWLD/cloak-boilerplate/blob/a1b2e0b41e489bb89157ad469655b9d9279a93a3/modules/routing.js#L24-L27

weotch commented 2 years ago

Actually, I think I can use this package, written by Nuxt team and already a dep, for this: https://github.com/unjs/defu ... i may need a custom merger though, because defu concats arrays by default. Also, the orders is reverse, defaults go in the second argument.