entityconvert.js
convert special characters in a string to their HTML or CSS charcode entities (useful for build tools et. al.)
The module works as AMD or CommonJS module and exports an Object exposing two methods: .html(string)
and .css(string)
. In a non-AMD and non-CommonJS environment .entityconvert
will be attached to the global object.
AMD usage:
require(['entityconvert'], function(entityconvert){
var converted = entityconvert.html('We äll löve Ümläutß!');
});
CommonJS usage:
var entityconvert = require('entity-convert');
var converted = entityconvert.css('We äll löve Ümläutß!');
Script tag usage:
<script src="entityconvert.js"></script>
<script>
var converted = entityconvert.html('Yäy!');
</script>
Available via npm:
npm install entity-convert --save
##License
MIT © Frederik Ring