entity-convert
Advanced tools
Comparing version 0.0.4 to 1.0.0
@@ -28,3 +28,3 @@ (function(root, factory){ | ||
mode === 'css' ? | ||
['\\00', code.toString(16)] : | ||
['\\00', code.toString(16), ' '] : | ||
['&#', code, ';'] | ||
@@ -36,3 +36,3 @@ ).join(''); | ||
var index = character.charCodeAt(0); | ||
return (index > 127) ? getEnt(index) : character; | ||
return (index < 32 || index > 127) ? getEnt(index) : character; | ||
}; | ||
@@ -53,2 +53,2 @@ | ||
})); | ||
})); |
@@ -1,1 +0,1 @@ | ||
(function(n,t){if(typeof define==="function"&&define.amd){define(function(){return t()})}else if(typeof exports==="object"){module.exports=t()}else{n.entityconvert=t()}})(this,function(){function n(n,t){n=n.split("");for(var e=0,r=n.length;e<r;e++){n[e]=t(n[e])}return n.join("")}function t(n){function t(t){return(n==="css"?["\\00",t.toString(16)]:["&#",t,";"]).join("")}return function(n){var e=n.charCodeAt(0);return e>127?t(e):n}}function e(e){return function(r){return n(r,t(e))}}return{css:e("css"),html:e("html")}}); | ||
(function(n,t){if(typeof define==="function"&&define.amd){define(function(){return t()})}else if(typeof exports==="object"){module.exports=t()}else{n.entityconvert=t()}})(this,function(){function n(n,t){n=n.split("");for(var e=0,r=n.length;e<r;e++){n[e]=t(n[e])}return n.join("")}function t(n){function t(t){return(n==="css"?["\\00",t.toString(16)," "]:["&#",t,";"]).join("")}return function(n){var e=n.charCodeAt(0);return e<32||e>127?t(e):n}}function e(e){return function(r){return n(r,t(e))}}return{css:e("css"),html:e("html")}}); |
{ | ||
"name": "entity-convert", | ||
"version": "0.0.4", | ||
"version": "1.0.0", | ||
"description": "convert all special characters in a string to their corresponding HTML and CSS entities", | ||
@@ -9,5 +9,6 @@ "main": "entityconvert.js", | ||
"scripts": { | ||
"pretest": "node node_modules/jshint/bin/jshint entityconvert.js", | ||
"test": "node node_modules/mocha/bin/mocha test.js", | ||
"posttest": "node node_modules/uglify-js/bin/uglifyjs entityconvert.js > entityconvert.min.js --mangle" | ||
"pretest": "jshint entityconvert.js", | ||
"test": "mocha test.js", | ||
"build": "uglifyjs entityconvert.js > entityconvert.min.js --mangle", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
@@ -27,5 +28,5 @@ "bugs": { | ||
"jshint": "^2.5.5", | ||
"mocha": "*", | ||
"mocha": "^5.0.0", | ||
"uglify-js": "^2.4.15" | ||
} | ||
} |
# entityconvert.js | ||
#### convert special characters in a string to their HTML or CSS charcode entities (useful for build tools et. al.) | ||
> convert special characters in a string to their HTML or CSS charcode entities (useful for build tools et. al.) | ||
@@ -4,0 +4,0 @@ 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. |
@@ -29,3 +29,3 @@ var ec = require('./entityconvert'); | ||
ec.css('We äll löve Ümläutß!') | ||
, 'We \\00e4ll l\\00f6ve \\00dcml\\00e4ut\\00df!' | ||
, 'We \\00e4 ll l\\00f6 ve \\00dc ml\\00e4 ut\\00df !' | ||
); | ||
@@ -42,6 +42,6 @@ }); | ||
ec.css('p.foo#bar::before{content:\'Ümläut\';}') | ||
, 'p.foo#bar::before{content:\'\\00dcml\\00e4ut\';}' | ||
, 'p.foo#bar::before{content:\'\\00dc ml\\00e4 ut\';}' | ||
); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
97
0
5416
8