jashkenas / underscore

JavaScript's utility _ belt
https://underscorejs.org
MIT License
27.33k stars 5.53k forks source link

Move unwrapping methods to the primary underscore.js module #2860

Closed jgonggrijp closed 4 years ago

jgonggrijp commented 4 years ago

While writing an article on how to use the upcoming modular Underscore release, I realized that the division between the underscore.js and underscore-oop.js modules that I made in #2849 was a bit unnatural. As it was, the underscore.js module exported a _ function that could wrap a value, but the resulting wrapper had no unwrapping methods. To have the unwrapping methods, you needed to import underscore-oop.js for its side effects, but that also added all the array proxy methods. People who cherry-pick from the library may sometimes want to have wrapping and unwrapping but no array methods.

I reorganized this slightly so that underscore.js already packs the unwrapping methods. The remaining underscore-oop.js has only one job, i.e., to add the array methods, so I renamed it accordingly. The impact on the monolithic build is minimal because the unwrapping methods have no dependencies of their own.

I don't expect anyone to object to this change so I'm not going to ask for a review, but I'm creating this PR anyway in order to leave a trace. I will also hold off from merging until the Travis build has completed, to make sure that nothing breaks.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 96.263% when pulling a2c9f6db94e4a0c33aa46423a756998bd67d8de6 on jgonggrijp:underscore-unwrap into faac06d44aed1fbd6d964065cf92f390c920d2dd on jashkenas:master.