Comparing version 0.3.0 to 0.3.1
@@ -6,6 +6,7 @@ 'use strict'; | ||
var Grille = function(spreadsheet_id, storage, timeout) { | ||
var Grille = function(spreadsheet_id, storage, timeout, parallel_limit) { | ||
this.spreadsheet_id = spreadsheet_id; | ||
this.storage = storage || new RedisGrilleStorage(); | ||
this.timeout = timeout; | ||
this.parallel_limit = parallel_limit; | ||
this.content = {}; | ||
@@ -16,3 +17,3 @@ | ||
this.spreadsheet = new Spreadsheet(spreadsheet_id, timeout); | ||
this.spreadsheet = new Spreadsheet(spreadsheet_id, timeout, parallel_limit); | ||
}; | ||
@@ -19,0 +20,0 @@ |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var DEFAULT_TIMEOUT = 10 * 1000; | ||
var DEFAULT_PARALLEL_LIMIT = 5; | ||
@@ -19,5 +20,6 @@ /** | ||
*/ | ||
var Spreadsheet = function(sheet_id, timeout) { | ||
var Spreadsheet = function(sheet_id, timeout, parallel_limit) { | ||
this.id = sheet_id; | ||
this.timeout = timeout || DEFAULT_TIMEOUT; | ||
this.parallel_limit = parallel_limit || DEFAULT_PARALLEL_LIMIT; | ||
this.meta_worksheet = new Worksheet(sheet_id, Spreadsheet.META); | ||
@@ -55,3 +57,3 @@ this.meta = null; | ||
async.each(tabs, function(tab, cb) { | ||
async.eachLimit(tabs, self.parallel_limit, function(tab, cb) { | ||
self.loadWorksheet(tab, self.meta[tab].format, cb); | ||
@@ -145,2 +147,7 @@ }, function(err, results) { | ||
/** | ||
* Takes a hash(row) of data containing setting the value column as the value for the whole hash | ||
* | ||
* {'a': {'value': 1}} => {'a': 1} | ||
*/ | ||
Spreadsheet.extractKeyValue = function(keyvalues) { | ||
@@ -154,2 +161,7 @@ Object.keys(keyvalues).map(function(key) { | ||
/** | ||
* Takes a hash(row) of data containing a bunch of col-X values and converts it into a 2D array | ||
* | ||
* {'1': {'id': 1, 'col-1': 2, 'col-2': 3}, '2': {'id': 2, 'col-1': 4, 'col-2': 5}} => [[2, 3], [4, 5]] | ||
*/ | ||
Spreadsheet.extractArray = function(values) { | ||
@@ -219,5 +231,3 @@ var array = []; | ||
}; | ||
Spreadsheet.ValidationError = ValidationError; | ||
Spreadsheet.TimeoutError = TimeoutError; | ||
module.exports = Spreadsheet; |
{ | ||
"name": "grille", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Simple CMS using Google Spreadsheets", | ||
@@ -5,0 +5,0 @@ "main": "lib/grille.js", |
43502
1209