Fixed export module and add test and clean module and export declare function with props
This commit is contained in:
parent
88645b98ea
commit
2b170c9bc0
4
excel2json.d.ts
vendored
4
excel2json.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
interface Excel2JsonProps {
|
||||
export interface Excel2JsonProps {
|
||||
mappings?: Array<any>;
|
||||
saveToOutput?: boolean;
|
||||
outputPath?: string;
|
||||
@ -10,4 +10,4 @@ interface Excel2JsonProps {
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
declare function excel2json(props: Excel2JsonProps);
|
||||
export declare function excel2json(props: Excel2JsonProps);
|
||||
|
@ -117,6 +117,6 @@ function _internalExport(props = {}) {
|
||||
*
|
||||
* @returns JSON Object of result
|
||||
*/
|
||||
module.exports = excel2json = (props = {}) => {
|
||||
module.exports.excel2json = excel2json = (props = {}) => {
|
||||
return _internalExport(props);
|
||||
};
|
||||
|
11
index.js
11
index.js
@ -1,10 +1,5 @@
|
||||
// import excel2json module
|
||||
const excel2json = require("./excel2json");
|
||||
const { excel2json } = require("./excel2json");
|
||||
|
||||
// called function export excel2json
|
||||
const exported = excel2json({
|
||||
inputFile: "./data/source.xlsx"
|
||||
});
|
||||
|
||||
// output data from exported
|
||||
console.log("Output =>\n", exported);
|
||||
// export the function
|
||||
module.exports = excel2json;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "excel2json-xlsx",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"keywords": [
|
||||
"excel",
|
||||
"json",
|
||||
|
Loading…
Reference in New Issue
Block a user