Comparing version 0.4.0 to 1.0.0
@@ -24,12 +24,10 @@ /* adler32.js (C) 2014-present SheetJS -- http://sheetjs.com */ | ||
}(function(ADLER32) { | ||
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)); | ||
ADLER32.version = '1.0.0'; | ||
function adler32_bstr(bstr, seed) { | ||
var a = 1, b = 0, L = bstr.length, M = 0; | ||
if(typeof seed === 'number') { a = seed & 0xFFFF; b = seed >>> 16; } | ||
for(var i = 0; i < L;) { | ||
M = Math.min(L-i, 3850)+i; | ||
for(;i<M;i++) { | ||
a += bstr.charCodeAt(i); | ||
a += bstr.charCodeAt(i)&0xFF; | ||
b += a; | ||
@@ -43,8 +41,9 @@ } | ||
function adler32_buf(buf) { | ||
function adler32_buf(buf, seed) { | ||
var a = 1, b = 0, L = buf.length, M = 0; | ||
if(typeof seed === 'number') { a = seed & 0xFFFF; b = (seed >>> 16) & 0xFFFF; } | ||
for(var i = 0; i < L;) { | ||
M = Math.min(L-i, 3850)+i; | ||
for(;i<M;i++) { | ||
a += buf[i]; | ||
a += buf[i]&0xFF; | ||
b += a; | ||
@@ -58,4 +57,5 @@ } | ||
function adler32_str(str) { | ||
function adler32_str(str, seed) { | ||
var a = 1, b = 0, L = str.length, M = 0, c = 0, d = 0; | ||
if(typeof seed === 'number') { a = seed & 0xFFFF; b = seed >>> 16; } | ||
for(var i = 0; i < L;) { | ||
@@ -85,3 +85,3 @@ M = Math.min(L-i, 3850); | ||
} | ||
return (b << 16) | a; | ||
return ((b%65521) << 16) | (a%65521); | ||
} | ||
@@ -88,0 +88,0 @@ ADLER32.bstr = adler32_bstr; |
{ | ||
"name": "adler-32", | ||
"version": "0.4.0", | ||
"version": "1.0.0", | ||
"author": "sheetjs", | ||
@@ -13,2 +13,3 @@ "description": "Pure-JS ADLER-32", | ||
"concat-stream":"", | ||
"printj":"", | ||
"exit-on-epipe":"" | ||
@@ -18,3 +19,2 @@ }, | ||
"mocha":"", | ||
"xlsjs":"", | ||
"codepage":"" | ||
@@ -21,0 +21,0 @@ }, |
Sorry, the diff of this file is not supported yet
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 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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10951
2
5
1
141
3
+ Addedprintj@
+ Addedprintj@1.3.1(transitive)