Comparing version 0.3.0 to 0.4.0
/* adler32.js (C) 2014-present SheetJS -- http://sheetjs.com */ | ||
/* vim: set ts=2: */ | ||
/*exported ADLER32 */ | ||
var ADLER32; | ||
(function (factory) { | ||
/*jshint ignore:start */ | ||
if(typeof DO_NOT_EXPORT_ADLER === 'undefined') { | ||
@@ -20,10 +22,10 @@ if('object' === typeof exports) { | ||
} | ||
/*jshint ignore:end */ | ||
}(function(ADLER32) { | ||
ADLER32.version = '0.3.0'; | ||
/* consult README.md for the magic number */ | ||
/* charCodeAt is the best approach for binary strings */ | ||
ADLER32.version = '0.4.0'; | ||
/*global Buffer */ | ||
var use_buffer = typeof Buffer !== 'undefined'; | ||
function adler32_bstr(bstr) { | ||
if(bstr.length > 32768) if(use_buffer) return adler32_buf(new Buffer(bstr)); | ||
var a = 1, b = 0, L = bstr.length, M; | ||
var a = 1, b = 0, L = bstr.length, M = 0; | ||
for(var i = 0; i < L;) { | ||
@@ -42,3 +44,3 @@ M = Math.min(L-i, 3850)+i; | ||
function adler32_buf(buf) { | ||
var a = 1, b = 0, L = buf.length, M; | ||
var a = 1, b = 0, L = buf.length, M = 0; | ||
for(var i = 0; i < L;) { | ||
@@ -56,5 +58,4 @@ M = Math.min(L-i, 3850)+i; | ||
/* much much faster to intertwine utf8 and adler */ | ||
function adler32_str(str) { | ||
var a = 1, b = 0, L = str.length, M, c, d; | ||
var a = 1, b = 0, L = str.length, M = 0, c = 0, d = 0; | ||
for(var i = 0; i < L;) { | ||
@@ -64,6 +65,6 @@ M = Math.min(L-i, 3850); | ||
c = str.charCodeAt(i++); | ||
if(c < 0x80) { a += c; b += a; --M; } | ||
if(c < 0x80) { a += c; } | ||
else if(c < 0x800) { | ||
a += 192|((c>>6)&31); b += a; --M; | ||
a += 128|(c&63); b += a; --M; | ||
a += 128|(c&63); | ||
} else if(c >= 0xD800 && c < 0xE000) { | ||
@@ -74,11 +75,12 @@ c = (c&1023)+64; d = str.charCodeAt(i++) & 1023; | ||
a += 128|((d>>6)&15)|((c&3)<<4); b += a; --M; | ||
a += 128|(d&63); b += a; --M; | ||
a += 128|(d&63); | ||
} else { | ||
a += 224|((c>>12)&15); b += a; --M; | ||
a += 128|((c>>6)&63); b += a; --M; | ||
a += 128|(c&63); b += a; --M; | ||
a += 128|(c&63); | ||
} | ||
b += a; --M; | ||
} | ||
a %= 65521; | ||
b %= 65521; | ||
a = (15*(a>>>16)+(a&65535)); | ||
b = (15*(b>>>16)+(b&65535)); | ||
} | ||
@@ -85,0 +87,0 @@ return (b << 16) | a; |
{ | ||
"name": "adler-32", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"author": "sheetjs", | ||
"description": "Pure-JS ADLER-32", | ||
"keywords": [ "adler32", "checksum" ], | ||
"bin": { | ||
"adler32": "./bin/adler32.njs" | ||
}, | ||
"main": "./adler32", | ||
"dependencies": { | ||
"concat-stream":"", | ||
"exit-on-epipe":"" | ||
}, | ||
"devDependencies": { | ||
"mocha":"", | ||
"xlsjs":"", | ||
"uglify-js":"", | ||
"codepage":"" | ||
@@ -24,3 +30,3 @@ }, | ||
}, | ||
"files": ["adler32.js", "LICENSE", "README.md"], | ||
"files": ["adler32.js", "bin/adler32.njs", "LICENSE", "README.md"], | ||
"bugs": { "url": "https://github.com/SheetJS/js-adler32/issues" }, | ||
@@ -27,0 +33,0 @@ "license": "Apache-2.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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
3
85
4533
2
3
0
+ Addedconcat-stream@
+ Addedexit-on-epipe@
+ Addedbuffer-from@1.1.2(transitive)
+ Addedconcat-stream@2.0.0(transitive)
+ Addedexit-on-epipe@1.0.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedutil-deprecate@1.0.2(transitive)