utils-extend
Advanced tools
Comparing version 1.0.5 to 1.0.6
22
index.js
@@ -13,3 +13,3 @@ /** | ||
return toString.call(value) === '[object ' + item + ']'; | ||
} | ||
}; | ||
}); | ||
@@ -81,4 +81,22 @@ | ||
return result; | ||
} | ||
}; | ||
exports.escape = function(value) { | ||
return String(value) | ||
.replace(/&/g, '&') | ||
.replace(/"/g, '"') | ||
.replace(/'/g, ''') | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); | ||
}; | ||
exports.unescape = function(value) { | ||
return String(value) | ||
.replace(/&/g, '&') | ||
.replace(/"/g, '"') | ||
.replace(/'/g, "'") | ||
.replace(/</g, '<') | ||
.replace(/>/g, '>'); | ||
}; | ||
exports.hrtime = function(time) { | ||
@@ -85,0 +103,0 @@ if (time) { |
{ | ||
"name": "utils-extend", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Extend nodejs util api, and it is light weight and simple", | ||
@@ -23,2 +23,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"mocha": "^2.0.1" | ||
@@ -25,0 +27,0 @@ }, |
## utils-extend | ||
Strengthen the ability of util. utils extend node util origin module | ||
Extend nodejs util api, and it is light weight and simple | ||
``` | ||
@@ -57,2 +57,12 @@ var util = require('utils-extend'); | ||
### util.escape | ||
Escapes a string for insertion into HTML, replacing &, <, >, ", `, and ' characters. | ||
```js | ||
var html = '<div></div>' | ||
var result = util.escape('<div></div>') | ||
``` | ||
### util.unescape | ||
The opposite of escape | ||
### util.path.isAbsolute | ||
@@ -59,0 +69,0 @@ Return true is path isabsolute, otherwise return false. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7260
7
198
78
3