(options, callback, onError)
| 123 | } |
| 124 | |
| 125 | const gsheetProcessor = function (options, callback, onError) { |
| 126 | const {apiKey, sheetId, sheetName, sheetNumber, returnAllResults, filter, filterOptions} = options |
| 127 | |
| 128 | if(!options.apiKey || options.apiKey === undefined) { |
| 129 | throw new Error('Missing Sheets API key'); |
| 130 | } |
| 131 | |
| 132 | return GSheetsapi({ |
| 133 | apiKey, |
| 134 | sheetId, |
| 135 | sheetName, |
| 136 | sheetNumber |
| 137 | }) |
| 138 | .then(result => { |
| 139 | const filteredResults = processGSheetResults( |
| 140 | result, |
| 141 | returnAllResults || false, |
| 142 | filter || false, |
| 143 | filterOptions || { |
| 144 | operator: 'or', |
| 145 | matching: 'loose' |
| 146 | } |
| 147 | ); |
| 148 | |
| 149 | callback(filteredResults); |
| 150 | }) |
| 151 | .catch(err => onError(err.message)); |
| 152 | }; |
| 153 | |
| 154 | export default gsheetProcessor; |
nothing calls this directly
no test coverage detected