entity-convert
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "entity-convert", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "convert all special characters in a string to their corresponding HTML and CSS entities", | ||
@@ -8,4 +8,9 @@ "main": "entityconvert.js", | ||
"homepage": "https://github.com/m90/entity-convert", | ||
"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" | ||
}, | ||
"bugs": { | ||
"url" : "https://github.com/m90/entity-convert/issues" | ||
"url": "https://github.com/m90/entity-convert/issues" | ||
}, | ||
@@ -19,3 +24,8 @@ "keywords": [ | ||
"author": "Frederik Ring", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"devDependencies": { | ||
"jshint": "^2.5.5", | ||
"mocha": "*", | ||
"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.) | ||
The module works as AMD or CommonJS module and exports an Object containing two functions: `.html(str)` and `.css(str)`. In a non-AMD or CommonJS environment `window.entityconvert` will be exported. | ||
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 like: | ||
AMD usage: | ||
```javascript | ||
require(['entityconvert'], function(entityconvert){ | ||
var converted = entityconvert.html('We äll löve Ümläutß!'); | ||
// => We äll löve Ümläutß! | ||
var converted = entityconvert.html('We äll löve Ümläutß!'); | ||
// => We äll löve Ümläutß! | ||
}); | ||
``` | ||
CommonJS usage like: | ||
CommonJS usage: | ||
```javascript | ||
@@ -21,2 +21,11 @@ var entityconvert = require('entity-convert'); | ||
Script tag usage: | ||
```html | ||
<script src="entityconvert.js"></script> | ||
<script> | ||
var converted = entityconvert.html('Yäy!'); | ||
// => Yäy! | ||
</script> | ||
``` | ||
Available via npm: | ||
@@ -28,2 +37,2 @@ ```sh | ||
##License | ||
MIT © [Frederik Ring](https://github.com/m90) | ||
MIT © [Frederik Ring](http://www.frederikring.com) |
Sorry, the diff of this file is not supported yet
5450
9
92
36
3