extract-sample
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -43,2 +43,11 @@ // Copyright 2014 Cubane Canada | ||
function escapeChar(t) { | ||
if (t === undefined) { | ||
t = ' '.charCodeAt(0); | ||
} else if (t < 32 || t > 127 || t === 92 || t === 34) { | ||
t = '.'.charCodeAt(0); | ||
} | ||
return String.fromCharCode(t); | ||
} | ||
function char16(buffer) { | ||
@@ -49,8 +58,3 @@ var i, a = [], t; | ||
t = buffer.readUInt8(i, true); | ||
if (t === undefined) { | ||
t = ' '.charCodeAt(0); | ||
} else if (t < 32 || t > 127) { | ||
t = '.'.charCodeAt(0); | ||
} | ||
a.push(String.fromCharCode(t)); | ||
a.push(escapeChar(t)); | ||
} | ||
@@ -101,1 +105,2 @@ return a.join(""); | ||
formatDump.c_escape = c_escape; | ||
formatDump.escapeChar = escapeChar; |
{ | ||
"name": "extract-sample", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "extract a sample record from a binary file and format as C string", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -122,2 +122,7 @@ /*global describe, it*/ | ||
}); | ||
it('escapes backslash and quote to dot', function () { | ||
assert.equal(dumpFormatter.escapeChar('\\'.charCodeAt(0)), '.'); | ||
assert.equal(dumpFormatter.escapeChar('"'.charCodeAt(0)), '.'); | ||
}); | ||
}); |
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
54490
418