Socket
Socket
Sign inDemoInstall

ent

Package Overview
Dependencies
0
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

.npmignore

8

index.js

@@ -24,3 +24,6 @@ var fs = require('fs');

}
else if (cc > 127) {
else if (c.match(/\s/)) {
return c;
}
else if (cc < 32 || cc >= 127) {
return '&#' + cc + ';';

@@ -43,2 +46,5 @@ }

})
.replace(/&#[xX]([A-Fa-f0-9]+);?/, function (_, hex) {
return String.fromCharCode(parseInt(hex, 16));
})
.replace(/&([^;\W]+;?)/g, function (m, e) {

@@ -45,0 +51,0 @@ var ee = e.replace(/;$/, '');

3

package.json
{
"name": "ent",
"description": "Encode and decode HTML entities",
"version": "0.0.2",
"version": "0.0.3",
"repository": "https://github.com/substack/node-ent.git",

@@ -16,2 +16,3 @@ "author": "James Halliday <mail@substack.net> (http://substack.net)",

],
"license" : "perl",
"scripts": {

@@ -18,0 +19,0 @@ "test": "expresso"

@@ -24,1 +24,29 @@ var assert = require('assert');

};
exports.hex = function () {
for (var i = 0; i < 32; i++) {
var a = String.fromCharCode(i);
if (a.match(/\s/)) {
assert.equal(ent.decode(a), a);
}
else {
var b = '&#x' + i.toString(16) + ';';
assert.equal(ent.decode(b), a);
assert.equal(ent.encode(a), '&#' + i + ';');
}
}
for (var i = 127; i < 2000; i++) {
var a = String.fromCharCode(i);
var b = '&#x' + i.toString(16) + ';';
var c = '&#X' + i.toString(16) + ';';
assert.equal(ent.decode(b), a);
assert.equal(ent.decode(c), a);
var encoded = ent.encode(a);
if (!encoded.match(/^&\w+;/)) {
assert.equal(encoded, '&#' + i + ';');
}
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc