From 75c49ddbe89bd511899f540b1766d78b6498c141 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sat, 21 Apr 2018 11:16:37 -0400 Subject: [PATCH] flow update --- .flowconfig | 3 --- bits/05_buf.js | 6 +++--- bits/35_custprops.js | 1 - bits/48_stybin.js | 2 +- misc/flow.js | 5 +++++ misc/flowdeps.js | 14 +++++++------- xlsx.flow.js | 9 ++++----- xlsx.js | 1 - 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.flowconfig b/.flowconfig index e5a7c21..9f2a25d 100644 --- a/.flowconfig +++ b/.flowconfig @@ -36,6 +36,3 @@ module.file_ext=.js module.file_ext=.njs module.ignore_non_literal_requires=true suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore - -[lints] -deprecated-declare-exports=off diff --git a/bits/05_buf.js b/bits/05_buf.js index ac12910..bf3bcbf 100644 --- a/bits/05_buf.js +++ b/bits/05_buf.js @@ -7,12 +7,12 @@ function new_raw_buf(len/*:number*/) { /* jshint +W056 */ } -function s2a(s/*:string*/) { +function s2a(s/*:string*/)/*:any*/ { if(has_buf) return new Buffer(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; }); } -function s2ab(s/*:string*/) { +function s2ab(s/*:string*/)/*:any*/ { if(typeof ArrayBuffer === 'undefined') return s2a(s); var buf = new ArrayBuffer(s.length), view = new Uint8Array(buf); for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; diff --git a/bits/35_custprops.js b/bits/35_custprops.js index ebaa3ae..2bfb5db 100644 --- a/bits/35_custprops.js +++ b/bits/35_custprops.js @@ -57,7 +57,6 @@ function write_cust_props(cp/*::, opts*/)/*:string*/ { if(!cp) return o.join(""); var pid = 1; keys(cp).forEach(function custprop(k) { ++pid; - // $FlowIgnore o[o.length] = (writextag('property', write_vt(cp[k]), { 'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}', 'pid': pid, diff --git a/bits/48_stybin.js b/bits/48_stybin.js index dc593e9..ed6baff 100644 --- a/bits/48_stybin.js +++ b/bits/48_stybin.js @@ -58,7 +58,7 @@ function parse_BrtFont(data, length/*:number*/, opts) { return out; } -function write_BrtFont(font, o) { +function write_BrtFont(font/*:any*/, o) { if(!o) o = new_buf(25+4*32); o.write_shift(2, font.sz * 20); write_FontFlags(font, o); diff --git a/misc/flow.js b/misc/flow.js index 57fc498..76ae4b3 100644 --- a/misc/flow.js +++ b/misc/flow.js @@ -29,6 +29,7 @@ type WBWBProps = { Names?: Array; Views?: Array; WBProps?: WBProps; + SheetNames?: Array; }; type WBProps = { @@ -61,6 +62,8 @@ type WBWSProp = { interface CellAddress { r:number; c:number; + cRel?:boolean; + rRel?:boolean; }; type CellAddrSpec = CellAddress | string; @@ -122,6 +125,8 @@ type ColInfo = { wch?:number; // width in characters MDW?:number; // Excel's "Max Digit Width" unit, always integral + + customWidth?:boolean; }; interface Margins { diff --git a/misc/flowdeps.js b/misc/flowdeps.js index 2099b41..e8d7675 100644 --- a/misc/flowdeps.js +++ b/misc/flowdeps.js @@ -1,14 +1,14 @@ /*:: declare module 'exit-on-epipe' {}; -declare module 'xlsx' { declare var exports:XLSXModule; }; -declare module '../' { declare var exports:XLSXModule; }; +declare module 'xlsx' { declare module.exports:XLSXModule; }; +declare module '../' { declare module.exports:XLSXModule; }; -declare module 'commander' { declare var exports:any; }; -declare module './jszip.js' { declare var exports:any; }; -declare module './dist/cpexcel.js' { declare var exports:any; }; -declare module 'crypto' { declare var exports:any; }; -declare module 'fs' { declare var exports:any; }; +declare module 'commander' { declare module.exports:any; }; +declare module './jszip.js' { declare module.exports:any; }; +declare module './dist/cpexcel.js' { declare module.exports:any; }; +declare module 'crypto' { declare module.exports:any; }; +declare module 'fs' { declare module.exports:any; }; type ZIP = any; diff --git a/xlsx.flow.js b/xlsx.flow.js index 7fd5ee5..f95cee8 100644 --- a/xlsx.flow.js +++ b/xlsx.flow.js @@ -132,12 +132,12 @@ function new_raw_buf(len/*:number*/) { /* jshint +W056 */ } -function s2a(s/*:string*/) { +function s2a(s/*:string*/)/*:any*/ { if(has_buf) return new Buffer(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; }); } -function s2ab(s/*:string*/) { +function s2ab(s/*:string*/)/*:any*/ { if(typeof ArrayBuffer === 'undefined') return s2a(s); var buf = new ArrayBuffer(s.length), view = new Uint8Array(buf); for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; @@ -4194,7 +4194,6 @@ function write_cust_props(cp/*::, opts*/)/*:string*/ { if(!cp) return o.join(""); var pid = 1; keys(cp).forEach(function custprop(k) { ++pid; - // $FlowIgnore o[o.length] = (writextag('property', write_vt(cp[k]), { 'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}', 'pid': pid, @@ -8247,7 +8246,7 @@ function parse_BrtFont(data, length/*:number*/, opts) { return out; } -function write_BrtFont(font, o) { +function write_BrtFont(font/*:any*/, o) { if(!o) o = new_buf(25+4*32); o.write_shift(2, font.sz * 20); write_FontFlags(font, o); diff --git a/xlsx.js b/xlsx.js index 2e713f7..c0a05d9 100644 --- a/xlsx.js +++ b/xlsx.js @@ -4105,7 +4105,6 @@ function write_cust_props(cp) { if(!cp) return o.join(""); var pid = 1; keys(cp).forEach(function custprop(k) { ++pid; - // $FlowIgnore o[o.length] = (writextag('property', write_vt(cp[k]), { 'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}', 'pid': pid,