Skip to content
Browse files

`undefined` bugfix

  • Loading branch information...
1 parent b92d92c commit 94653dd57d69c943265f55930e81fa66c372133a @pvorb committed Sep 15, 2011
Showing with 6 additions and 2 deletions.
  1. +3 −1 esc.js
  2. +1 −1 package.json
  3. +2 −0 test.js
View
4 esc.js
@@ -3,7 +3,9 @@ var append = require('append'),
path = require('path');
module.exports = function(str, opt) {
- if (typeof str !== 'string')
+ if (typeof str == 'undefined')
+ str = '';
+ if (typeof str != 'string')
str = str.toString();
// default options
View
2 package.json
@@ -2,7 +2,7 @@
"author": "Paul Vorbach <paul@vorb.de> (http://vorb.de/)",
"name": "esc",
"description": "escapes HTML",
- "version": "0.0.0",
+ "version": "0.0.1",
"repository": {
"type": "git",
"url": "git://github.com/pvorb/node-esc.git"
View
2 test.js
@@ -8,3 +8,5 @@ fs.writeFileSync('test-1.html', esc(html, { 'uri': 'http://example.com' }));
fs.writeFileSync('test-2.html', esc(html, { 'uri': 'http://example.com/' }));
fs.writeFileSync('test-3.html', esc(html, { 'uri': 'http://example.com/dir/doc.html' }));
+
+esc(undefined);

0 comments on commit 94653dd

Please sign in to comment.
Something went wrong with that request. Please try again.