Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

edit-google-spreadsheet

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edit-google-spreadsheet - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

60

index.js

@@ -8,6 +8,16 @@

_ = require("underscore"),
num = require("../utils").num,
GoogleClientLogin = require('googleclientlogin').GoogleClientLogin;
//parse number
var num = function(obj) {
if(obj === undefined) return 0;
if(typeof obj === 'number') return obj;
if(typeof obj === 'string') {
var res = parseFloat(obj, 10);
if(isNaN(res)) return obj;
return res;
}
throw "Invalid number: " + JSON.stringify(obj);
};
//spreadsheet class

@@ -20,12 +30,2 @@ function Spreadsheet() {

Spreadsheet.create = function(usr, pw, spreadsheetId, worksheetId, done) {
var s = new Spreadsheet();
s.spreadsheetId = spreadsheetId;
s.worksheetId = worksheetId;
s.setTemplates();
s.auth(usr, pw, function(err) {
done(err, s);
});
};
Spreadsheet.prototype.auth = function(usr, pw, done) {

@@ -62,2 +62,3 @@ if(!usr || !pw || !done) return;

Spreadsheet.prototype.setTemplates = function() {
this.bodyTemplate = _.template(

@@ -219,2 +220,7 @@ '<feed xmlns="http://www.w3.org/2005/Atom"\n' +

if(!this.token)
return callback("No authorization token. Use auth() first.");
if(!this.bodyTemplate || !this.entryTemplate)
return callback("No templates have been created. Use setTemplates() first.");
var _this = this,

@@ -259,4 +265,30 @@ entries = this.toString(),

//entry point
module.exports = Spreadsheet;
//public api
module.exports = {
create: function(opts) {
var s = new Spreadsheet();
if(!opts.callback) throw "Missing callback";
var check = function(n) {
if(opts[n])
return true;
else
opts.callback("Missing '"+n+"'");
return false;
};
if(!(check('username') &&
check('password') &&
check('worksheetId') &&
check('worksheetId'))) return;
s.spreadsheetId = opts.spreadsheetId;
s.worksheetId = opts.worksheetId;
s.setTemplates();
s.auth(opts.username, opts.password, function(err) {
opts.callback(err, s);
});
}
};
{
"name": "edit-google-spreadsheet",
"version": "0.0.1",
"dependencies": {
"colors": "*",
"request": "*",
"underscore": "*",
"coffee-script": "*"
},
"version": "0.0.2",
"dependencies": [
"colors",
"underscore",
"request",
"googleclientlogin"
],
"engines": {

@@ -11,0 +11,0 @@ "node": "~0.8.x"

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