I am using underscore on my projects, but now I want to extend it a using the underscore.string
I read their documentation, and it seems I could have problems using both if I don't take the extra measures they say to take:
var _ = require('underscore');
// Import Underscore.string to separate object, because there are conflict functions (include, reverse, contains)
_.str = require('underscore.string');
// Mix in non-conflict functions to Underscore namespace if you want
_.mixin(_.str.exports());
// All functions, include conflict, will be available through _.str object
_.str.include('Underscore.string', 'string'); // => true
However, I don't have any idea of how to follow those steps, I need help understanding the steps to work with both and have no trouble using them.
So far, I have done this:
<script src="underscore-min.js" type="text/javascript"></script>
<script src="underscore.string.min.js" type="text/javascript"></script>
Also another related question, when I manage to work with both, must I always use _.str
, or only on the conflicted functions?