underscore.string
String manipulation helpers for javascript
underscore.string
I'm having trouble getting underscore.strings working with AngularJS.
The documentation around underscore.strings always shows examples with requireJs which I don't think is appropriate for AngularJS.
I can't access the string functions with any of these statments, I'm a little confused on how I'm supposed to initialize underscore.strings without requirejs
<script src="/bower_components/underscore/underscore.js"></script>
<script src="/bower_components/underscore.string/dist/underscore.string.js"></script>
<script type="text/javascript">
$(document).ready(function() {
try {
console.log(_); // Returns a reference to Underscore
} catch (e) {
console.log(e);
}
try {
console.log(_s); // Undefined
} catch (e) {
console.log(e);
}
try {
console.log(_.str); // Undefined
} catch (e) {
console.log(e);
}
try {
console.log(_.string); // Undefined
} catch (e) {
console.log(e);
}
});
</script>
Source: (StackOverflow)
I need to convert snippets of text that contain html tags into plain text using Javascript / Node.Js.
I currently use String.Js library for that, but the problem is that when it removes the tags (using strip_tags() functions), it also removes the new line.
E.g.
<div>Some text</div><div>another text</div>
becomes
Some textanother text
Do you know how I could get rid of this problem? Maybe another library?
Thanks!
Source: (StackOverflow)
Underscore.string seems to provide nice features for javascript string manipulation.
It seems to have all the good points:
Except one point for which I am missing info: the "browser support/compatibility". I am especially worried about older version of IE.
I could find some issues (who have been fixed) on Github for various browser versions, but I could not find any clear statement regarding the browser support:
I also searched on StackOverflow & did some googling but no luck.
I assume there is no "official" support for browsers so if anyone has experience in using Underscore.string in a production environment where users are on old browsers (IE8+) that would be great.
EDIT:
I also added a question directly on Github to try to get an answer, I'll update this page if I hear anything from there. See https://github.com/epeli/underscore.string/issues/304
Source: (StackOverflow)