@eredzik/calaminejs 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/calamine_js.d.ts +67 -0
- package/dist/node/calamine_js.js +598 -0
- package/dist/node/calamine_js_bg.wasm +0 -0
- package/dist/node/calamine_js_bg.wasm.d.ts +59 -0
- package/dist/web/calamine_js.d.ts +150 -0
- package/dist/web/calamine_js.js +681 -0
- package/dist/web/calamine_js_bg.wasm +0 -0
- package/dist/web/calamine_js_bg.wasm.d.ts +59 -0
- package/package.json +35 -31
- package/README.md +0 -103
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export class CellValue {
|
|
4
|
+
private constructor();
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
to_int_value(): bigint | undefined;
|
|
8
|
+
to_bool_value(): boolean | undefined;
|
|
9
|
+
to_float_value(): number | undefined;
|
|
10
|
+
to_string_value(): string | undefined;
|
|
11
|
+
readonly is_datetime: boolean;
|
|
12
|
+
readonly is_duration: boolean;
|
|
13
|
+
readonly is_int: boolean;
|
|
14
|
+
readonly is_bool: boolean;
|
|
15
|
+
readonly is_empty: boolean;
|
|
16
|
+
readonly is_error: boolean;
|
|
17
|
+
readonly is_float: boolean;
|
|
18
|
+
readonly is_string: boolean;
|
|
19
|
+
}
|
|
20
|
+
export class HeaderInfo {
|
|
21
|
+
private constructor();
|
|
22
|
+
free(): void;
|
|
23
|
+
[Symbol.dispose](): void;
|
|
24
|
+
readonly column_names: string[];
|
|
25
|
+
readonly row_index: number;
|
|
26
|
+
}
|
|
27
|
+
export class Sheet {
|
|
28
|
+
private constructor();
|
|
29
|
+
free(): void;
|
|
30
|
+
[Symbol.dispose](): void;
|
|
31
|
+
/**
|
|
32
|
+
* Convert sheet to Parquet format
|
|
33
|
+
* Returns the Parquet file as bytes
|
|
34
|
+
*/
|
|
35
|
+
to_parquet(): Uint8Array;
|
|
36
|
+
/**
|
|
37
|
+
* Infer which row is the table header
|
|
38
|
+
* Returns HeaderInfo with the row index and column names, or None if no header is found
|
|
39
|
+
*
|
|
40
|
+
* This function uses heuristics to detect the header row:
|
|
41
|
+
* - Headers typically contain string values in most columns
|
|
42
|
+
* - Headers are followed by rows with data
|
|
43
|
+
* - Headers have multiple non-empty cells
|
|
44
|
+
*/
|
|
45
|
+
infer_header_row(): HeaderInfo | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Convert sheet to Parquet format with custom column names
|
|
48
|
+
* column_names: array of column names (must match col_count)
|
|
49
|
+
*/
|
|
50
|
+
to_parquet_with_names(column_names: string[]): Uint8Array;
|
|
51
|
+
get_cell(row: number, col: number): CellValue | undefined;
|
|
52
|
+
col_count(): number;
|
|
53
|
+
row_count(): number;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly rows: Array<any>;
|
|
56
|
+
}
|
|
57
|
+
export class Workbook {
|
|
58
|
+
private constructor();
|
|
59
|
+
free(): void;
|
|
60
|
+
[Symbol.dispose](): void;
|
|
61
|
+
static from_bytes(data: Uint8Array): Workbook;
|
|
62
|
+
sheet_count(): number;
|
|
63
|
+
sheet_names(): Array<any>;
|
|
64
|
+
get_sheet_by_index(index: number): Sheet | undefined;
|
|
65
|
+
static from_bytes_with_progress(data: Uint8Array, progress_callback?: Function | null, progress_interval?: number | null): Workbook;
|
|
66
|
+
get_sheet(name: string): Sheet | undefined;
|
|
67
|
+
}
|
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
|
|
2
|
+
let imports = {};
|
|
3
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
|
+
|
|
5
|
+
let WASM_VECTOR_LEN = 0;
|
|
6
|
+
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const cachedTextEncoder = new TextEncoder();
|
|
17
|
+
|
|
18
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
19
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
20
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
21
|
+
view.set(buf);
|
|
22
|
+
return {
|
|
23
|
+
read: arg.length,
|
|
24
|
+
written: buf.length
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
30
|
+
|
|
31
|
+
if (realloc === undefined) {
|
|
32
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
33
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
34
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
35
|
+
WASM_VECTOR_LEN = buf.length;
|
|
36
|
+
return ptr;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let len = arg.length;
|
|
40
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
41
|
+
|
|
42
|
+
const mem = getUint8ArrayMemory0();
|
|
43
|
+
|
|
44
|
+
let offset = 0;
|
|
45
|
+
|
|
46
|
+
for (; offset < len; offset++) {
|
|
47
|
+
const code = arg.charCodeAt(offset);
|
|
48
|
+
if (code > 0x7F) break;
|
|
49
|
+
mem[ptr + offset] = code;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (offset !== len) {
|
|
53
|
+
if (offset !== 0) {
|
|
54
|
+
arg = arg.slice(offset);
|
|
55
|
+
}
|
|
56
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
57
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
58
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
59
|
+
|
|
60
|
+
offset += ret.written;
|
|
61
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
WASM_VECTOR_LEN = offset;
|
|
65
|
+
return ptr;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isLikeNone(x) {
|
|
69
|
+
return x === undefined || x === null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let cachedDataViewMemory0 = null;
|
|
73
|
+
|
|
74
|
+
function getDataViewMemory0() {
|
|
75
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
76
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
77
|
+
}
|
|
78
|
+
return cachedDataViewMemory0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
82
|
+
|
|
83
|
+
cachedTextDecoder.decode();
|
|
84
|
+
|
|
85
|
+
function decodeText(ptr, len) {
|
|
86
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function getStringFromWasm0(ptr, len) {
|
|
90
|
+
ptr = ptr >>> 0;
|
|
91
|
+
return decodeText(ptr, len);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function addToExternrefTable0(obj) {
|
|
95
|
+
const idx = wasm.__externref_table_alloc();
|
|
96
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
97
|
+
return idx;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function handleError(f, args) {
|
|
101
|
+
try {
|
|
102
|
+
return f.apply(this, args);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
const idx = addToExternrefTable0(e);
|
|
105
|
+
wasm.__wbindgen_exn_store(idx);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
110
|
+
ptr = ptr >>> 0;
|
|
111
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
115
|
+
ptr = ptr >>> 0;
|
|
116
|
+
const mem = getDataViewMemory0();
|
|
117
|
+
const result = [];
|
|
118
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
119
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
120
|
+
}
|
|
121
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function takeFromExternrefTable0(idx) {
|
|
126
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
127
|
+
wasm.__externref_table_dealloc(idx);
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
132
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
133
|
+
for (let i = 0; i < array.length; i++) {
|
|
134
|
+
const add = addToExternrefTable0(array[i]);
|
|
135
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
136
|
+
}
|
|
137
|
+
WASM_VECTOR_LEN = array.length;
|
|
138
|
+
return ptr;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
142
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
143
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
144
|
+
WASM_VECTOR_LEN = arg.length;
|
|
145
|
+
return ptr;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const CellValueFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
149
|
+
? { register: () => {}, unregister: () => {} }
|
|
150
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_cellvalue_free(ptr >>> 0, 1));
|
|
151
|
+
|
|
152
|
+
class CellValue {
|
|
153
|
+
|
|
154
|
+
static __wrap(ptr) {
|
|
155
|
+
ptr = ptr >>> 0;
|
|
156
|
+
const obj = Object.create(CellValue.prototype);
|
|
157
|
+
obj.__wbg_ptr = ptr;
|
|
158
|
+
CellValueFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
159
|
+
return obj;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
__destroy_into_raw() {
|
|
163
|
+
const ptr = this.__wbg_ptr;
|
|
164
|
+
this.__wbg_ptr = 0;
|
|
165
|
+
CellValueFinalization.unregister(this);
|
|
166
|
+
return ptr;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
free() {
|
|
170
|
+
const ptr = this.__destroy_into_raw();
|
|
171
|
+
wasm.__wbg_cellvalue_free(ptr, 0);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @returns {boolean}
|
|
175
|
+
*/
|
|
176
|
+
get is_datetime() {
|
|
177
|
+
const ret = wasm.cellvalue_is_datetime(this.__wbg_ptr);
|
|
178
|
+
return ret !== 0;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @returns {boolean}
|
|
182
|
+
*/
|
|
183
|
+
get is_duration() {
|
|
184
|
+
const ret = wasm.cellvalue_is_duration(this.__wbg_ptr);
|
|
185
|
+
return ret !== 0;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @returns {bigint | undefined}
|
|
189
|
+
*/
|
|
190
|
+
to_int_value() {
|
|
191
|
+
const ret = wasm.cellvalue_to_int_value(this.__wbg_ptr);
|
|
192
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @returns {boolean | undefined}
|
|
196
|
+
*/
|
|
197
|
+
to_bool_value() {
|
|
198
|
+
const ret = wasm.cellvalue_to_bool_value(this.__wbg_ptr);
|
|
199
|
+
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @returns {number | undefined}
|
|
203
|
+
*/
|
|
204
|
+
to_float_value() {
|
|
205
|
+
const ret = wasm.cellvalue_to_float_value(this.__wbg_ptr);
|
|
206
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @returns {string | undefined}
|
|
210
|
+
*/
|
|
211
|
+
to_string_value() {
|
|
212
|
+
const ret = wasm.cellvalue_to_string_value(this.__wbg_ptr);
|
|
213
|
+
let v1;
|
|
214
|
+
if (ret[0] !== 0) {
|
|
215
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
216
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
217
|
+
}
|
|
218
|
+
return v1;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @returns {boolean}
|
|
222
|
+
*/
|
|
223
|
+
get is_int() {
|
|
224
|
+
const ret = wasm.cellvalue_is_int(this.__wbg_ptr);
|
|
225
|
+
return ret !== 0;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @returns {boolean}
|
|
229
|
+
*/
|
|
230
|
+
get is_bool() {
|
|
231
|
+
const ret = wasm.cellvalue_is_bool(this.__wbg_ptr);
|
|
232
|
+
return ret !== 0;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @returns {boolean}
|
|
236
|
+
*/
|
|
237
|
+
get is_empty() {
|
|
238
|
+
const ret = wasm.cellvalue_is_empty(this.__wbg_ptr);
|
|
239
|
+
return ret !== 0;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @returns {boolean}
|
|
243
|
+
*/
|
|
244
|
+
get is_error() {
|
|
245
|
+
const ret = wasm.cellvalue_is_error(this.__wbg_ptr);
|
|
246
|
+
return ret !== 0;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @returns {boolean}
|
|
250
|
+
*/
|
|
251
|
+
get is_float() {
|
|
252
|
+
const ret = wasm.cellvalue_is_float(this.__wbg_ptr);
|
|
253
|
+
return ret !== 0;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @returns {boolean}
|
|
257
|
+
*/
|
|
258
|
+
get is_string() {
|
|
259
|
+
const ret = wasm.cellvalue_is_string(this.__wbg_ptr);
|
|
260
|
+
return ret !== 0;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (Symbol.dispose) CellValue.prototype[Symbol.dispose] = CellValue.prototype.free;
|
|
264
|
+
|
|
265
|
+
exports.CellValue = CellValue;
|
|
266
|
+
|
|
267
|
+
const HeaderInfoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
268
|
+
? { register: () => {}, unregister: () => {} }
|
|
269
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_headerinfo_free(ptr >>> 0, 1));
|
|
270
|
+
|
|
271
|
+
class HeaderInfo {
|
|
272
|
+
|
|
273
|
+
static __wrap(ptr) {
|
|
274
|
+
ptr = ptr >>> 0;
|
|
275
|
+
const obj = Object.create(HeaderInfo.prototype);
|
|
276
|
+
obj.__wbg_ptr = ptr;
|
|
277
|
+
HeaderInfoFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
278
|
+
return obj;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
__destroy_into_raw() {
|
|
282
|
+
const ptr = this.__wbg_ptr;
|
|
283
|
+
this.__wbg_ptr = 0;
|
|
284
|
+
HeaderInfoFinalization.unregister(this);
|
|
285
|
+
return ptr;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
free() {
|
|
289
|
+
const ptr = this.__destroy_into_raw();
|
|
290
|
+
wasm.__wbg_headerinfo_free(ptr, 0);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* @returns {string[]}
|
|
294
|
+
*/
|
|
295
|
+
get column_names() {
|
|
296
|
+
const ret = wasm.headerinfo_column_names(this.__wbg_ptr);
|
|
297
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
298
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
299
|
+
return v1;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* @returns {number}
|
|
303
|
+
*/
|
|
304
|
+
get row_index() {
|
|
305
|
+
const ret = wasm.headerinfo_row_index(this.__wbg_ptr);
|
|
306
|
+
return ret >>> 0;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (Symbol.dispose) HeaderInfo.prototype[Symbol.dispose] = HeaderInfo.prototype.free;
|
|
310
|
+
|
|
311
|
+
exports.HeaderInfo = HeaderInfo;
|
|
312
|
+
|
|
313
|
+
const SheetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
314
|
+
? { register: () => {}, unregister: () => {} }
|
|
315
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_sheet_free(ptr >>> 0, 1));
|
|
316
|
+
|
|
317
|
+
class Sheet {
|
|
318
|
+
|
|
319
|
+
static __wrap(ptr) {
|
|
320
|
+
ptr = ptr >>> 0;
|
|
321
|
+
const obj = Object.create(Sheet.prototype);
|
|
322
|
+
obj.__wbg_ptr = ptr;
|
|
323
|
+
SheetFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
324
|
+
return obj;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
__destroy_into_raw() {
|
|
328
|
+
const ptr = this.__wbg_ptr;
|
|
329
|
+
this.__wbg_ptr = 0;
|
|
330
|
+
SheetFinalization.unregister(this);
|
|
331
|
+
return ptr;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
free() {
|
|
335
|
+
const ptr = this.__destroy_into_raw();
|
|
336
|
+
wasm.__wbg_sheet_free(ptr, 0);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Convert sheet to Parquet format
|
|
340
|
+
* Returns the Parquet file as bytes
|
|
341
|
+
* @returns {Uint8Array}
|
|
342
|
+
*/
|
|
343
|
+
to_parquet() {
|
|
344
|
+
const ret = wasm.sheet_to_parquet(this.__wbg_ptr);
|
|
345
|
+
if (ret[3]) {
|
|
346
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
347
|
+
}
|
|
348
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
349
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
350
|
+
return v1;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Infer which row is the table header
|
|
354
|
+
* Returns HeaderInfo with the row index and column names, or None if no header is found
|
|
355
|
+
*
|
|
356
|
+
* This function uses heuristics to detect the header row:
|
|
357
|
+
* - Headers typically contain string values in most columns
|
|
358
|
+
* - Headers are followed by rows with data
|
|
359
|
+
* - Headers have multiple non-empty cells
|
|
360
|
+
* @returns {HeaderInfo | undefined}
|
|
361
|
+
*/
|
|
362
|
+
infer_header_row() {
|
|
363
|
+
const ret = wasm.sheet_infer_header_row(this.__wbg_ptr);
|
|
364
|
+
return ret === 0 ? undefined : HeaderInfo.__wrap(ret);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Convert sheet to Parquet format with custom column names
|
|
368
|
+
* column_names: array of column names (must match col_count)
|
|
369
|
+
* @param {string[]} column_names
|
|
370
|
+
* @returns {Uint8Array}
|
|
371
|
+
*/
|
|
372
|
+
to_parquet_with_names(column_names) {
|
|
373
|
+
const ptr0 = passArrayJsValueToWasm0(column_names, wasm.__wbindgen_malloc);
|
|
374
|
+
const len0 = WASM_VECTOR_LEN;
|
|
375
|
+
const ret = wasm.sheet_to_parquet_with_names(this.__wbg_ptr, ptr0, len0);
|
|
376
|
+
if (ret[3]) {
|
|
377
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
378
|
+
}
|
|
379
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
380
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
381
|
+
return v2;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* @returns {string}
|
|
385
|
+
*/
|
|
386
|
+
get name() {
|
|
387
|
+
let deferred1_0;
|
|
388
|
+
let deferred1_1;
|
|
389
|
+
try {
|
|
390
|
+
const ret = wasm.sheet_name(this.__wbg_ptr);
|
|
391
|
+
deferred1_0 = ret[0];
|
|
392
|
+
deferred1_1 = ret[1];
|
|
393
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
394
|
+
} finally {
|
|
395
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* @returns {Array<any>}
|
|
400
|
+
*/
|
|
401
|
+
get rows() {
|
|
402
|
+
const ret = wasm.sheet_rows(this.__wbg_ptr);
|
|
403
|
+
return ret;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* @param {number} row
|
|
407
|
+
* @param {number} col
|
|
408
|
+
* @returns {CellValue | undefined}
|
|
409
|
+
*/
|
|
410
|
+
get_cell(row, col) {
|
|
411
|
+
const ret = wasm.sheet_get_cell(this.__wbg_ptr, row, col);
|
|
412
|
+
return ret === 0 ? undefined : CellValue.__wrap(ret);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* @returns {number}
|
|
416
|
+
*/
|
|
417
|
+
col_count() {
|
|
418
|
+
const ret = wasm.sheet_col_count(this.__wbg_ptr);
|
|
419
|
+
return ret >>> 0;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* @returns {number}
|
|
423
|
+
*/
|
|
424
|
+
row_count() {
|
|
425
|
+
const ret = wasm.sheet_row_count(this.__wbg_ptr);
|
|
426
|
+
return ret >>> 0;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (Symbol.dispose) Sheet.prototype[Symbol.dispose] = Sheet.prototype.free;
|
|
430
|
+
|
|
431
|
+
exports.Sheet = Sheet;
|
|
432
|
+
|
|
433
|
+
const WorkbookFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
434
|
+
? { register: () => {}, unregister: () => {} }
|
|
435
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_workbook_free(ptr >>> 0, 1));
|
|
436
|
+
|
|
437
|
+
class Workbook {
|
|
438
|
+
|
|
439
|
+
static __wrap(ptr) {
|
|
440
|
+
ptr = ptr >>> 0;
|
|
441
|
+
const obj = Object.create(Workbook.prototype);
|
|
442
|
+
obj.__wbg_ptr = ptr;
|
|
443
|
+
WorkbookFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
444
|
+
return obj;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
__destroy_into_raw() {
|
|
448
|
+
const ptr = this.__wbg_ptr;
|
|
449
|
+
this.__wbg_ptr = 0;
|
|
450
|
+
WorkbookFinalization.unregister(this);
|
|
451
|
+
return ptr;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
free() {
|
|
455
|
+
const ptr = this.__destroy_into_raw();
|
|
456
|
+
wasm.__wbg_workbook_free(ptr, 0);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* @param {Uint8Array} data
|
|
460
|
+
* @returns {Workbook}
|
|
461
|
+
*/
|
|
462
|
+
static from_bytes(data) {
|
|
463
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
464
|
+
const len0 = WASM_VECTOR_LEN;
|
|
465
|
+
const ret = wasm.workbook_from_bytes(ptr0, len0);
|
|
466
|
+
if (ret[2]) {
|
|
467
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
468
|
+
}
|
|
469
|
+
return Workbook.__wrap(ret[0]);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* @returns {number}
|
|
473
|
+
*/
|
|
474
|
+
sheet_count() {
|
|
475
|
+
const ret = wasm.workbook_sheet_count(this.__wbg_ptr);
|
|
476
|
+
return ret >>> 0;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @returns {Array<any>}
|
|
480
|
+
*/
|
|
481
|
+
sheet_names() {
|
|
482
|
+
const ret = wasm.workbook_sheet_names(this.__wbg_ptr);
|
|
483
|
+
return ret;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* @param {number} index
|
|
487
|
+
* @returns {Sheet | undefined}
|
|
488
|
+
*/
|
|
489
|
+
get_sheet_by_index(index) {
|
|
490
|
+
const ret = wasm.workbook_get_sheet_by_index(this.__wbg_ptr, index);
|
|
491
|
+
return ret === 0 ? undefined : Sheet.__wrap(ret);
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @param {Uint8Array} data
|
|
495
|
+
* @param {Function | null} [progress_callback]
|
|
496
|
+
* @param {number | null} [progress_interval]
|
|
497
|
+
* @returns {Workbook}
|
|
498
|
+
*/
|
|
499
|
+
static from_bytes_with_progress(data, progress_callback, progress_interval) {
|
|
500
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
501
|
+
const len0 = WASM_VECTOR_LEN;
|
|
502
|
+
const ret = wasm.workbook_from_bytes_with_progress(ptr0, len0, isLikeNone(progress_callback) ? 0 : addToExternrefTable0(progress_callback), isLikeNone(progress_interval) ? 0x100000001 : (progress_interval) >>> 0);
|
|
503
|
+
if (ret[2]) {
|
|
504
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
505
|
+
}
|
|
506
|
+
return Workbook.__wrap(ret[0]);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* @param {string} name
|
|
510
|
+
* @returns {Sheet | undefined}
|
|
511
|
+
*/
|
|
512
|
+
get_sheet(name) {
|
|
513
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
514
|
+
const len0 = WASM_VECTOR_LEN;
|
|
515
|
+
const ret = wasm.workbook_get_sheet(this.__wbg_ptr, ptr0, len0);
|
|
516
|
+
return ret === 0 ? undefined : Sheet.__wrap(ret);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
if (Symbol.dispose) Workbook.prototype[Symbol.dispose] = Workbook.prototype.free;
|
|
520
|
+
|
|
521
|
+
exports.Workbook = Workbook;
|
|
522
|
+
|
|
523
|
+
exports.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
|
|
524
|
+
const obj = arg1;
|
|
525
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
526
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
527
|
+
var len1 = WASM_VECTOR_LEN;
|
|
528
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
529
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
533
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
exports.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
|
|
537
|
+
const ret = arg0.call(arg1, arg2);
|
|
538
|
+
return ret;
|
|
539
|
+
}, arguments) };
|
|
540
|
+
|
|
541
|
+
exports.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
|
|
542
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
543
|
+
}, arguments) };
|
|
544
|
+
|
|
545
|
+
exports.__wbg_log_8cec76766b8c0e33 = function(arg0) {
|
|
546
|
+
console.log(arg0);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
exports.__wbg_new_1acc0b6eea89d040 = function() {
|
|
550
|
+
const ret = new Object();
|
|
551
|
+
return ret;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
exports.__wbg_new_e17d9f43105b08be = function() {
|
|
555
|
+
const ret = new Array();
|
|
556
|
+
return ret;
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
exports.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
|
|
560
|
+
const ret = arg0.push(arg1);
|
|
561
|
+
return ret;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
exports.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
565
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
566
|
+
return ret;
|
|
567
|
+
}, arguments) };
|
|
568
|
+
|
|
569
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
570
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
571
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
572
|
+
return ret;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
576
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
577
|
+
const ret = arg0;
|
|
578
|
+
return ret;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
exports.__wbindgen_init_externref_table = function() {
|
|
582
|
+
const table = wasm.__wbindgen_externrefs;
|
|
583
|
+
const offset = table.grow(4);
|
|
584
|
+
table.set(0, undefined);
|
|
585
|
+
table.set(offset + 0, undefined);
|
|
586
|
+
table.set(offset + 1, null);
|
|
587
|
+
table.set(offset + 2, true);
|
|
588
|
+
table.set(offset + 3, false);
|
|
589
|
+
;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
const wasmPath = `${__dirname}/calamine_js_bg.wasm`;
|
|
593
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
594
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
595
|
+
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
596
|
+
|
|
597
|
+
wasm.__wbindgen_start();
|
|
598
|
+
|
|
Binary file
|