Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pemrouz
committed
Feb 6, 2016
0 parents
commit e4b788f
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
coverage | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- "stable" | ||
|
||
after_script: NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = function escape(str) { | ||
return str.replace(/[&<>'"]/g, function(char){ | ||
return safe[char] | ||
}) | ||
} | ||
|
||
var safe = { | ||
"&": "&" | ||
, "<": "<" | ||
, ">": ">" | ||
, '"': """ | ||
, "'": "'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "utilise.escape", | ||
"version": "0.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "istanbul test ./node_modules/mocha/bin/_mocha --report html -- -R spec", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && rm -rf ./coverage" | ||
}, | ||
"author": "Pedram Emrouznejad (https://github.com/pemrouz)", | ||
"license": "pemrouz.mit-license.org", | ||
"devDependencies": { | ||
"chai": "^2.3.0", | ||
"coveralls": "^2.11.2", | ||
"istanbul": "^0.3.13", | ||
"mocha": "^2.2.4", | ||
"mocha-lcov-reporter": "0.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var expect = require('chai').expect | ||
, escape = require('./') | ||
|
||
describe('escape', function() { | ||
it('should escape html', function() { | ||
expect(escape('<div></div>')).to.eql('<div></div>') | ||
}) | ||
}) |