version bump 1.0.8: Buffer.from node 4.x fix

This commit is contained in:
SheetJS 2018-07-08 04:08:15 -04:00
parent c88a98104d
commit 8ee792f343
12 changed files with 40 additions and 24 deletions

View File

@ -1,8 +1,11 @@
var has_buf = (typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && process.versions.node);
var Buffer_from = /*::(*/function(){}/*:: :any)*/;
if(typeof Buffer !== 'undefined') {
// $FlowIgnore
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
var nbfs = !Buffer.from;
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
// $FlowIgnore
if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); };
}
@ -15,7 +18,7 @@ function new_raw_buf(len/*:number*/) {
var s2a = function s2a(s/*:string*/) {
if(has_buf) return Buffer.from(s, "binary");
return s.split("").map(function(x){ return x.charCodeAt(0) & 0xff; });
return s.split("").map(function(x/*:string*/)/*:number*/{ return x.charCodeAt(0) & 0xff; });
};
var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g;

View File

@ -22,7 +22,8 @@ if(has_buf/*:: && typeof Buffer !== 'undefined'*/) {
};
__hexlify = function(b/*:RawBytes|CFBlob*/,s/*:number*/,l/*:number*/)/*:string*/ { return Buffer.isBuffer(b)/*:: && b instanceof Buffer*/ ? b.toString('hex',s,s+l) : ___hexlify(b,s,l); };
__toBuffer = function(bufs/*:Array<Array<RawBytes>>*/)/*:RawBytes*/ { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat((bufs[0]/*:any*/)) : ___toBuffer(bufs);};
s2a = function(s/*:string*/)/*:RawBytes*/ { return Buffer.from(s, "binary"); };
// $FlowIgnore
s2a = function(s/*:string*/)/*:RawBytes*/ { return Buffer_from(s, "binary"); };
bconcat = function(bufs/*:Array<RawBytes>*/)/*:RawBytes*/ { return Buffer.isBuffer(bufs[0]) ? Buffer.concat(/*::(*/bufs/*:: :any)*/) : __bconcat(bufs); };
}

View File

@ -1 +1 @@
exports.version = '1.0.7';
exports.version = '1.0.8';

View File

@ -50,9 +50,12 @@ var Base64 = (function make_b64(){
})();
var has_buf = (typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && process.versions.node);
var Buffer_from = /*::(*/function(){}/*:: :any)*/;
if(typeof Buffer !== 'undefined') {
// $FlowIgnore
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
var nbfs = !Buffer.from;
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
// $FlowIgnore
if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); };
}
@ -65,7 +68,7 @@ function new_raw_buf(len/*:number*/) {
var s2a = function s2a(s/*:string*/) {
if(has_buf) return Buffer.from(s, "binary");
return s.split("").map(function(x){ return x.charCodeAt(0) & 0xff; });
return s.split("").map(function(x/*:string*/)/*:number*/{ return x.charCodeAt(0) & 0xff; });
};
var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g;
@ -93,7 +96,8 @@ if(has_buf/*:: && typeof Buffer !== 'undefined'*/) {
};
__hexlify = function(b/*:RawBytes|CFBlob*/,s/*:number*/,l/*:number*/)/*:string*/ { return Buffer.isBuffer(b)/*:: && b instanceof Buffer*/ ? b.toString('hex',s,s+l) : ___hexlify(b,s,l); };
__toBuffer = function(bufs/*:Array<Array<RawBytes>>*/)/*:RawBytes*/ { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat((bufs[0]/*:any*/)) : ___toBuffer(bufs);};
s2a = function(s/*:string*/)/*:RawBytes*/ { return Buffer.from(s, "binary"); };
// $FlowIgnore
s2a = function(s/*:string*/)/*:RawBytes*/ { return Buffer_from(s, "binary"); };
bconcat = function(bufs/*:Array<RawBytes>*/)/*:RawBytes*/ { return Buffer.isBuffer(bufs[0]) ? Buffer.concat(/*::(*/bufs/*:: :any)*/) : __bconcat(bufs); };
}
@ -183,7 +187,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20171201 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '1.0.7';
exports.version = '1.0.8';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");

12
cfb.js
View File

@ -50,9 +50,12 @@ var Base64 = (function make_b64(){
})();
var has_buf = (typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && process.versions.node);
var Buffer_from = function(){};
if(typeof Buffer !== 'undefined') {
// $FlowIgnore
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
var nbfs = !Buffer.from;
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
// $FlowIgnore
if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); };
}
@ -93,7 +96,8 @@ if(has_buf) {
};
__hexlify = function(b,s,l) { return Buffer.isBuffer(b) ? b.toString('hex',s,s+l) : ___hexlify(b,s,l); };
__toBuffer = function(bufs) { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat((bufs[0])) : ___toBuffer(bufs);};
s2a = function(s) { return Buffer.from(s, "binary"); };
// $FlowIgnore
s2a = function(s) { return Buffer_from(s, "binary"); };
bconcat = function(bufs) { return Buffer.isBuffer(bufs[0]) ? Buffer.concat(bufs) : __bconcat(bufs); };
}
@ -165,7 +169,7 @@ function new_buf(sz) {
/* [MS-CFB] v20171201 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '1.0.7';
exports.version = '1.0.8';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");

12
dist/cfb.js vendored
View File

@ -50,9 +50,12 @@ var Base64 = (function make_b64(){
})();
var has_buf = (typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && process.versions.node);
var Buffer_from = function(){};
if(typeof Buffer !== 'undefined') {
// $FlowIgnore
if(!Buffer.from) Buffer.from = function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); };
var nbfs = !Buffer.from;
if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; }
Buffer_from = nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer);
// $FlowIgnore
if(!Buffer.alloc) Buffer.alloc = function(n) { return new Buffer(n); };
}
@ -93,7 +96,8 @@ if(has_buf) {
};
__hexlify = function(b,s,l) { return Buffer.isBuffer(b) ? b.toString('hex',s,s+l) : ___hexlify(b,s,l); };
__toBuffer = function(bufs) { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat((bufs[0])) : ___toBuffer(bufs);};
s2a = function(s) { return Buffer.from(s, "binary"); };
// $FlowIgnore
s2a = function(s) { return Buffer_from(s, "binary"); };
bconcat = function(bufs) { return Buffer.isBuffer(bufs[0]) ? Buffer.concat(bufs) : __bconcat(bufs); };
}
@ -165,7 +169,7 @@ function new_buf(sz) {
/* [MS-CFB] v20171201 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '1.0.7';
exports.version = '1.0.8';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");

2
dist/cfb.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/cfb.min.map vendored

File diff suppressed because one or more lines are too long

2
dist/xlscfb.js vendored
View File

@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20171201 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '1.0.7';
exports.version = '1.0.8';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");

View File

@ -1,6 +1,6 @@
{
"name": "cfb",
"version": "1.0.7",
"version": "1.0.8",
"author": "sheetjs",
"description": "Compound File Binary File Format extractor",
"keywords": [

View File

@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20171201 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '1.0.7';
exports.version = '1.0.8';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");

View File

@ -8,7 +8,7 @@ var DO_NOT_EXPORT_CFB = true;
/* [MS-CFB] v20171201 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '1.0.7';
exports.version = '1.0.8';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");