Lodash and Underscore have a method called mixin that allow you to extend the libraries. How do you write a library that will extend them?
For example, if you created a file called "extend_lodash.js", with the following content:
_.mixin({
new_function:function(){}
})
How would you work with it on your project? The code below won't work:
_ = require("lodash");
require("extend_lodash.js");
As 'mu is too short' also suggests, have your file with the lodash mixin return lodash.
In your "extend_lodash.js" file:
var _ = require('lodash');
_.mixin({
new_function:function(){}
});
module.exports = _;
And then in the caller, you just require your mixin and get lodash from that:
var _ = require("extend_lodash");