jQuery’s extend function has the option of recursive extension, which I use when creating json config files. I can see that underscore has an extend function, but it doesn’t even mention recursion. I assume this means it doesn’t recursively extend, but I thought I’d ask here before implementing it into my project and wasting a lot of time.
jQuery’s extend function has the option of recursive extension, which I use when creating
Share
Your assumption is correct, Underscore’s
extenddoes not recursively extend. The implementation is rather simple:The most interesting part for you is what’s inside the
forloop, a simple non-recursive assignment: