Merge pull request #31947 from cWatermelon/node-xlsx

Added typings for node-xlsx
This commit is contained in:
Daniel Rosenwasser
2019-01-15 17:35:29 -08:00
committed by GitHub
4 changed files with 67 additions and 0 deletions
+35
View File
@@ -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;
+8
View File
@@ -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 }]);
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }