edit-google-spreadsheet
Advanced tools
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" |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 4 instances in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 4 instances in 1 package
7693
234
0
4
+ Added0@colors
+ Added1@underscore
+ Added2@request
+ Added3@googleclientlogin
- Removedcoffee-script@*
- Removedcolors@*
- Removedrequest@*
- Removedunderscore@*
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcoffee-script@1.12.7(transitive)
- Removedcolors@1.4.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedunderscore@1.13.7(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)