New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

public-google-sheets-parser

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

public-google-sheets-parser - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

.github/workflows/test.yml

15

package.json
{
"name": "public-google-sheets-parser",
"version": "1.1.1",
"version": "1.1.2",
"description": "Get JSONArray from public google sheets with using only spreadsheetId",

@@ -9,3 +9,4 @@ "scripts": {

"lint": "eslint --format ./node_modules/eslint-friendly-formatter --ext .js .",
"lint:fix": "eslint --format ./node_modules/eslint-friendly-formatter --ext .js . --fix"
"lint:fix": "eslint --format ./node_modules/eslint-friendly-formatter --ext .js . --fix",
"coverage": "rimraf coverage && istanbul cover tape ./test/index.js"
},

@@ -37,3 +38,3 @@ "main": "src/index.js",

"hooks": {
"pre-commit": "npm run lint && npm test"
"pre-commit": "yarn lint && yarn test"
}

@@ -45,3 +46,4 @@ },

"example",
"dist"
"dist",
"coverage"
],

@@ -54,4 +56,9 @@ "devDependencies": {

"eslint": "^7.14.0",
"eslint-config-standard": "^16.0.2",
"eslint-friendly-formatter": "^4.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"husky": "^4.3.0",
"istanbul": "^1.1.0-alpha.1",
"rimraf": "^3.0.2",
"standard": "^16.0.3",

@@ -58,0 +65,0 @@ "tape": "^5.0.1"

@@ -5,5 +5,6 @@ # Public Google sheets parser

[![npm package](https://img.shields.io/npm/v/public-google-sheets-parser.svg?cacheSeconds=3600&style=flat-square)](https://www.npmjs.com/package/public-google-sheets-parser)
[![GitHub stars](https://img.shields.io/github/stars/fureweb-com/public-google-sheets-parser?color=brightgreen)](https://github.com/fureweb-com/public-google-sheets-parser/stargazers)
[![codecov](https://codecov.io/gh/fureweb-com/public-google-sheets-parser/branch/main/graph/badge.svg?token=7C40G6CV5O)](https://codecov.io/gh/fureweb-com/public-google-sheets-parser)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Ffureweb-com%2Fpublic-google-sheets-parser)](https://hits.seeyoufarm.com)
[![GitHub stars](https://img.shields.io/github/stars/fureweb-com/public-google-sheets-parser?color=brightgreen)](https://github.com/fureweb-com/public-google-sheets-parser/stargazers)

@@ -28,2 +29,14 @@ ![Introduction](introduction.png)

### Installation
With yarn:
```bash
$ yarn add public-google-sheets-parser
```
With npm:
```bash
$ npm i public-google-sheets-parser
```
### Usage example

@@ -30,0 +43,0 @@ - Node.js

const isBrowser = typeof require === 'undefined'
const fetch = isBrowser ? window.fetch : require('node-fetch')
const fetch = isBrowser ? /* istanbul ignore next */ window.fetch : require('node-fetch')

@@ -25,3 +25,3 @@ class PublicGoogleSheetsParser {

.then((r) => r.ok ? r.text() : null)
.catch((_) => null)
.catch(/* istanbul ignore next */(_) => null)
}

@@ -74,2 +74,3 @@

/* istanbul ignore next */
if (isBrowser) {

@@ -76,0 +77,0 @@ window.PublicGoogleSheetsParser = PublicGoogleSheetsParser

@@ -89,1 +89,69 @@ const test = require('tape')

})
test('should get public holiday information in a spreadsheet using a specific year as the sheet name', async (t) => {
const spreadsheetId = '1K5oodBEghRG66WCPBumRTcexp70bZprfaXovqvoxNac'
parser.id = spreadsheetId
parser.sheetName = '2021'
const resultOf2021 = await parser.parse()
const expectedOf2021 = [
{ no: 1, date: '2021-01-01', name: '신정' },
{ no: 2, date: '2021-02-11', name: '구정' },
{ no: 3, date: '2021-02-12', name: '구정' },
{ no: 4, date: '2021-02-13', name: '구정' },
{ no: 5, date: '2021-03-01', name: '삼일절' },
{ no: 6, date: '2021-05-05', name: '어린이날' },
{ no: 7, date: '2021-05-19', name: '부처님오신날' },
{ no: 8, date: '2021-06-06', name: '현충일' },
{ no: 9, date: '2021-08-15', name: '광복절' },
{ no: 10, date: '2021-09-20', name: '추석' },
{ no: 11, date: '2021-09-21', name: '추석' },
{ no: 12, date: '2021-09-22', name: '추석' },
{ no: 13, date: '2021-10-03', name: '개천절' },
{ no: 14, date: '2021-10-09', name: '한글날' },
{ no: 15, date: '2021-12-25', name: '크리스마스' }
]
t.deepEqual(resultOf2021, expectedOf2021)
// change sheetName
parser.sheetName = '2022'
const resultOf2022 = await parser.parse()
const expectedOf2022 = [
{ no: 1, date: '2022-01-01', name: '신정' },
{ no: 2, date: '2022-02-01', name: '구정' },
{ no: 3, date: '2022-02-02', name: '구정' },
{ no: 4, date: '2022-02-03', name: '구정' },
{ no: 5, date: '2022-03-01', name: '삼일절' },
{ no: 6, date: '2022-05-05', name: '어린이날' },
{ no: 7, date: '2022-05-08', name: '부처님오신날' },
{ no: 8, date: '2022-06-06', name: '현충일' },
{ no: 9, date: '2022-08-15', name: '광복절' },
{ no: 10, date: '2022-09-09', name: '추석' },
{ no: 11, date: '2022-09-10', name: '추석' },
{ no: 12, date: '2022-09-11', name: '추석' },
{ no: 13, date: '2022-10-03', name: '개천절' },
{ no: 14, date: '2022-10-09', name: '한글날' },
{ no: 15, date: '2022-12-25', name: '크리스마스' }
]
t.deepEqual(resultOf2022, expectedOf2022)
t.end()
})
test('should throw when parse before set spreadsheetId', async (t) => {
const localParser = new PublicGoogleSheetsParser()
const actualError = await localParser.parse().catch((e) => e)
const expectedError = new Error('SpreadsheetId is required.')
t.deepEqual(actualError, expectedError)
})
test('should return expected array if document has no labels in cols', async (t) => {
parser.id = '15czdGBtjjA82zpp6Xh4CY9OWs4hUpO4ul7mk6VNPGEg'
const actualArray = await parser.parse()
const expectedArray = [
{ field1: 'a1', field2: 'a2', field3: 'a3' },
{ field1: 'b1', field2: 'b2', field3: 'b3' }
]
t.deepEqual(actualArray, expectedArray)
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc