mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31947 from cWatermelon/node-xlsx
Added typings for node-xlsx
This commit is contained in:
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for node-xlsx 0.12
|
||||
// Project: https://github.com/mgcrea/node-xlsx#readme
|
||||
// Definitions by: chenc <https://github.com/cWatermelon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
/**
|
||||
* parsing a xlsx from file/buffer, outputs an object of worksheets
|
||||
* @param mixed file path or buffer
|
||||
* @param options options is for xlsx
|
||||
* @returns worksheets data, like: { name: 'worksheets', data: [[1,2,3],['1', '2','word']] }
|
||||
*/
|
||||
export declare function parse(
|
||||
mixed: string | ArrayBuffer,
|
||||
options?: {}
|
||||
): Array<{
|
||||
name: string;
|
||||
data: Array<[]>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* building a xlsx
|
||||
* @param worksheets worksheets data, like:{ name: 'worksheets', data: [[1,2,3],['1', '2','word']] }
|
||||
* @param options spannig multiple rows A1:A4
|
||||
* @returns returns a buffer of worksheets
|
||||
*/
|
||||
export declare function build(
|
||||
worksheets: Array<{ name: string; data: any[][] }>,
|
||||
options?: {}
|
||||
): ArrayBuffer;
|
||||
declare const _default: {
|
||||
parse: typeof parse;
|
||||
build: typeof build;
|
||||
};
|
||||
export default _default;
|
||||
@@ -0,0 +1,8 @@
|
||||
import { build } from 'node-xlsx';
|
||||
const data = [
|
||||
[1, 2, 3],
|
||||
[true, false, null, 'sheetjs'],
|
||||
['foo', 'bar', new Date('2014-02-19T14:30Z'), '0.3'],
|
||||
['baz', null, 'qux'],
|
||||
];
|
||||
const buffer = build([{ name: 'mySheetName', data }]);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-xlsx-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user