react-google-forms-hooks
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -437,10 +437,10 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var assertValidUrl = function assertValidUrl(formUrl) { | ||
var googleFormsHost = 'docs.google.com'; | ||
var googleFormsHosts = ['docs.google.com', 'forms.gle']; | ||
var url = new URL(formUrl); | ||
if (url.host !== googleFormsHost) { | ||
throw new Error("Invalid google forms host. It must be " + googleFormsHost + " and is " + url.host + "."); | ||
if (!googleFormsHosts.includes(url.host)) { | ||
throw new Error("Invalid google forms host. " + url.host + " is expected to be " + googleFormsHosts.join(', ').replace(/, ([^,]*)$/, ' or $1') + "."); | ||
} | ||
if (!url.pathname.endsWith('/viewform')) { | ||
if (url.host === googleFormsHosts[0] && !url.pathname.endsWith('/viewform')) { | ||
throw new Error("Please use the form's public URL."); | ||
@@ -447,0 +447,0 @@ } |
@@ -435,10 +435,10 @@ import { useForm } from 'react-hook-form'; | ||
var assertValidUrl = function assertValidUrl(formUrl) { | ||
var googleFormsHost = 'docs.google.com'; | ||
var googleFormsHosts = ['docs.google.com', 'forms.gle']; | ||
var url = new URL(formUrl); | ||
if (url.host !== googleFormsHost) { | ||
throw new Error("Invalid google forms host. It must be " + googleFormsHost + " and is " + url.host + "."); | ||
if (!googleFormsHosts.includes(url.host)) { | ||
throw new Error("Invalid google forms host. " + url.host + " is expected to be " + googleFormsHosts.join(', ').replace(/, ([^,]*)$/, ' or $1') + "."); | ||
} | ||
if (!url.pathname.endsWith('/viewform')) { | ||
if (url.host === googleFormsHosts[0] && !url.pathname.endsWith('/viewform')) { | ||
throw new Error("Please use the form's public URL."); | ||
@@ -445,0 +445,0 @@ } |
{ | ||
"name": "react-google-forms-hooks", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Library to create forms using React backed by Google Forms.", | ||
@@ -5,0 +5,0 @@ "author": "francisconeves97", |
# React Google Forms Hooks | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -26,2 +29,3 @@ ## Description | ||
// can use both full and shortened form url | ||
const result = await googleFormsToJson( | ||
@@ -103,1 +107,21 @@ 'https://docs.google.com/forms/d/e/1FAIpQLSe5U3qvg8WHs4nkU-e6h2RlAD7fKoCkou6HO2w2-tXYIA_F8g/viewform' | ||
MIT © [francisconeves97](https://github.com/francisconeves97) | ||
## Contributors ✨ | ||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore-start --> | ||
<!-- markdownlint-disable --> | ||
<table> | ||
<tr> | ||
<td align="center"><a href="https://github.com/juliangsibecas"><img src="https://avatars.githubusercontent.com/u/25715495?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Julián Gómez Sibecas</b></sub></a><br /><a href="https://github.com/francisconeves97/react-google-forms-hooks/commits?author=juliangsibecas" title="Code">💻</a></td> | ||
</tr> | ||
</table> | ||
<!-- markdownlint-restore --> | ||
<!-- prettier-ignore-end --> | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
181002
39
1349
125