parent
df48a059c3
commit
36debb0eaa
@ -153,7 +153,13 @@ function utf8readb(data) {
|
||||
function utf8readc(data) { return Buffer_from(data, 'binary').toString('utf8'); }
|
||||
|
||||
var utf8corpus = "foo bar baz\u00e2\u0098\u0083\u00f0\u009f\u008d\u00a3";
|
||||
var utf8read = has_buf && (/*#__PURE__*/utf8readc(utf8corpus) == /*#__PURE__*/utf8reada(utf8corpus) && utf8readc || /*#__PURE__*/utf8readb(utf8corpus) == /*#__PURE__*/utf8reada(utf8corpus) && utf8readb) || utf8reada;
|
||||
var utf8read = /*#__PURE__*/(function() {
|
||||
if(has_buf) {
|
||||
if(utf8readc(utf8corpus) == utf8reada(utf8corpus)) return utf8readc;
|
||||
if(utf8readb(utf8corpus) == utf8reada(utf8corpus)) return utf8readb;
|
||||
}
|
||||
return utf8reada;
|
||||
})();
|
||||
|
||||
var utf8write/*:StringConv*/ = has_buf ? function(data) { return Buffer_from(data, 'utf8').toString("binary"); } : function(orig/*:string*/)/*:string*/ {
|
||||
var out/*:Array<string>*/ = [], i = 0, c = 0, d = 0;
|
||||
|
@ -111,7 +111,7 @@ function write_binary_type(out, opts/*:WriteOpts*/)/*:any*/ {
|
||||
|
||||
function writeSyncXLSX(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
if(!opts || !opts.unsafe) check_wb(wb);
|
||||
var o = dup(opts||{});
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSyncXLSX(wb, o)/*:any*/); o.type = "array"; return s2ab(out); }
|
||||
@ -120,7 +120,7 @@ function writeSyncXLSX(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
|
||||
function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
if(!opts || !opts.unsafe) check_wb(wb);
|
||||
var o = dup(opts||{});
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); }
|
||||
|
3
types/index.d.ts
vendored
3
types/index.d.ts
vendored
@ -317,6 +317,9 @@ export interface WritingOptions extends CommonOptions {
|
||||
|
||||
/** Record Separator ("row separator") for CSV / Text output */
|
||||
RS?: string;
|
||||
|
||||
/** Skip certain validity checks (NOTE: generated files may not open in Excel) */
|
||||
unsafe?: boolean;
|
||||
}
|
||||
|
||||
/** Workbook Object */
|
||||
|
Loading…
Reference in New Issue
Block a user