public-google-sheets-parser
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -14,3 +14,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
/* istanbul ignore next */ | ||
window.fetch : require('node-fetch'); | ||
window.fetch : require('./fetch'); | ||
@@ -40,3 +40,3 @@ let PublicGoogleSheetsParser = /*#__PURE__*/function () { | ||
return fetch(url).then(r => r.ok ? r.text() : null).catch( | ||
return fetch(url).then(r => r && r.ok && r.text ? r.text() : null).catch( | ||
/* istanbul ignore next */ | ||
@@ -43,0 +43,0 @@ _ => null); |
{ | ||
"name": "public-google-sheets-parser", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Get JSONArray from public google sheets with using only spreadsheetId", | ||
@@ -21,3 +21,4 @@ "scripts": { | ||
"google sheets", | ||
"spreadsheet" | ||
"spreadsheet", | ||
"zero-dependency" | ||
], | ||
@@ -24,0 +25,0 @@ "author": { |
@@ -1,2 +0,2 @@ | ||
# Public Google sheets parser | ||
# Public Google Sheets Parser | ||
@@ -12,4 +12,5 @@ [](https://github.com/fureweb-com) | ||
It is a simple parser that helps you use public Google sheets document as if they were a database. | ||
It is a simple and **zero dependency** parser that helps you use public Google sheets document as if they were a database. | ||
The document to be used must be a Google Sheets document in the 'public' state and have a header in the first row. (e.g. [Google sheets for example](https://docs.google.com/spreadsheets/d/10WDbAPAY7Xl5DT36VuMheTPTTpqx9x0C5sDCnh4BGps/edit#gid=1839148703)) | ||
@@ -110,3 +111,3 @@ | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/public-google-sheets-parser@1.0.21/dist/index.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/public-google-sheets-parser@latest"></script> | ||
@@ -117,4 +118,7 @@ <script> | ||
parser.parse(spreadsheetId).then((items) => { | ||
// items should be [{"a":1,"b":2,"c":3},{"a":4,"b":5,"c":6},{"a":7,"b":8,"c":9}] | ||
// items should be [{ a: 1, b: 2, c: 3 },{ a: 4, b: 5, c: 6 },{ a: 7, b: 8, c: 9 }] | ||
}) | ||
parser.parse(spreadsheetId, 'Sheet2').then((items) => { | ||
// items should be [{ a: 10, b: 20, c: 30 }, { a: 40, b: 50, c: 60 }, { a: 70, b: 80, c: 90 }] | ||
}) | ||
</script> | ||
@@ -121,0 +125,0 @@ ``` |
const https = require('https') | ||
const isBrowser = typeof require === 'undefined' | ||
@@ -20,5 +19,3 @@ const nodeFetch = async (url) => { | ||
const fetch = isBrowser ? /* istanbul ignore next */ window.fetch : nodeFetch | ||
module.exports = fetch | ||
module.exports.default = fetch | ||
module.exports = nodeFetch | ||
module.exports.default = nodeFetch |
const isBrowser = typeof require === 'undefined' | ||
const fetch = require('./fetch') | ||
const fetch = isBrowser ? /* istanbul ignore next */window.fetch : require('./fetch') | ||
@@ -4,0 +4,0 @@ class PublicGoogleSheetsParser { |
826493
134
3
322