Skip to content

Commit 1da46ed

Browse files
authored
Merge pull request theoephraim#114 from tablekat/FixInconsistentCallbacks
Made cell.save consistent with row.save in terms of requiring a callback (theoephraim#105)
2 parents 0b241d6 + d1a2dc5 commit 1da46ed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ var SpreadsheetWorksheet = function( spreadsheet, data ){
418418
spreadsheet.addRow(self.id, data, cb);
419419
}
420420
this.bulkUpdateCells = function(cells, cb) {
421+
if ( !cb ) cb = function(){};
422+
421423
var entries = cells.map(function (cell, i) {
422424
cell._needsSave = false;
423425
return "<entry>\n <batch:id>" + cell.batchId + "</batch:id>\n <batch:operation type=\"update\"/>\n <id>" + self['_links']['cells']+'/'+cell.batchId + "</id>\n <link rel=\"edit\" type=\"application/atom+xml\"\n href=\"" + cell._links.edit + "\"/>\n <gs:cell row=\"" + cell.row + "\" col=\"" + cell.col + "\" inputValue=\"" + cell.valueForSave + "\"/>\n </entry>";
@@ -440,6 +442,7 @@ var SpreadsheetWorksheet = function( spreadsheet, data ){
440442
}
441443

442444
this.setHeaderRow = function(values, cb) {
445+
if ( !cb ) cb = function(){};
443446
if (!values) return cb();
444447
if (values.length > self.colCount){
445448
return cb(new Error('Sheet is not large enough to fit '+values.length+' columns. Resize the sheet first.'));
@@ -620,6 +623,7 @@ var SpreadsheetCell = function( spreadsheet, worksheet_id, data ){
620623
});
621624

622625
self.save = function(cb) {
626+
if ( !cb ) cb = function(){};
623627
self._needsSave = false;
624628

625629
var edit_id = 'https://spreadsheets.google.com/feeds/cells/key/worksheetId/private/full/R'+self.row+'C'+self.col;

0 commit comments

Comments
 (0)