New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xls-to-json

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xls-to-json - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

27

libs/index.js

@@ -11,3 +11,3 @@ var fs = require('fs');

function XLS_json (config) {
function XLS_json (config, callback) {
console.log(config)

@@ -19,17 +19,11 @@ if(!config.input) {

if(!config.output) {
console.error("You miss a output file");
process.exit(2);
}
var cv = new CV(config);
var cv = new CV(config, callback);
}
function CV(config) {
function CV(config, callback) {
var wb = this.load_xls(config.input)
var ws = this.ws(wb);
var csv = this.csv(ws)
this.cvjson(csv, config.output)
this.cvjson(csv, config.output, callback)
}

@@ -54,3 +48,3 @@

CV.prototype.cvjson = function(csv, output) {
CV.prototype.cvjson = function(csv, output, callback) {
cvcsv()

@@ -79,4 +73,9 @@ .from.string(csv)

console.log('Number of lines: '+count);
var stream = fs.createWriteStream(output, { flags : 'w' });
stream.write(JSON.stringify(record));
if(output !== null) {
var stream = fs.createWriteStream(output, { flags : 'w' });
stream.write(JSON.stringify(record));
callback(null, record);
} else {
callback(null, record);
}

@@ -87,2 +86,2 @@ })

});
}
}
{
"name": "xls-to-json",
"version": "0.0.0",
"version": "0.0.1",
"description": "Converting xls file to json files using nodejs",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,3 +8,3 @@ # node-xls-json

```
npm install node-xls-to-json
npm install xls-to-json
```

@@ -15,9 +15,17 @@

```
node_xj = require("node-xls-to-json");
node_xj = require("xls-to-json");
node_xj({
input: "sample.xls",
output: "output.json"
}, function(err, result) {
if(err) {
console.error(err);
} else {
console.log(result);
}
});
```
In config object, you have to enter an input path. But If you don't want to output any file you can set to `null`.
## License

@@ -24,0 +32,0 @@

@@ -6,2 +6,10 @@ var xls_json = require('../')

output: __dirname + '/test.json'
}, function(err, result) {
if(err) {
console.error(err);
} else {
console.log(result);
}
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc