This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction(name, telephone, email) { | |
const requiredFields = name && telephone; | |
if (!requiredFields) { | |
const modalContainer = document.getElementById('modal-container'); | |
const modal = document.createElement('div'); | |
const basicString = 'Encountered a problem submitting the form. Missing ' | |
if (!name && !telephone) { | |
modal.textContent = basicString + 'name & telephone fields.'; | |
} else if (!name) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction(name, telephone, email) { | |
if (!name || !telephone) { | |
const modalContainer = document.getElementById('modal-container'); | |
const modal = document.createElement('div'); | |
const basicString = 'Encountered a problem submitting the form. Missing ' | |
if (!name && !telephone) { | |
modal.textContent = basicString + 'name & telephone fields.'; | |
} else if (!name) { | |
modal.textContent = basicString + 'name field.'; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submitForm(name, telephone, email) { | |
const requiredFields = name && telephone; | |
if (!requiredFields) { | |
showAlert(); | |
return; | |
} | |
postForm(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submitForm(name, telephone, email) { | |
if (!name || !telephone) { | |
showAlert(); | |
return; | |
} | |
postForm(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groupSentencesUpToX from './groupSentencesUpToX'; | |
export default groupSentencesUpToX(?, 5000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { JSDOM } from 'jsdom'; | |
import getElements from './common/getElements'; | |
import fetchSentiments from './common/fetchSentiments'; | |
import formatSentiments from './common/formatSentiments'; | |
import getSentences from './common/getSentences'; | |
import groupSentencesUpTo5000 from './common/groupSentencesUpTo5000'; | |
import stripNonSentences from './common/stripNonSentences'; | |
/** | |
* Gets the 'sentiment' of an HTML page using the AWS Comprehend API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { JSDOM } from 'jsdom'; | |
import getAverageWordLength from './common/getAverageWordLength'; | |
import getElements from './common/getElements'; | |
import getSentences from './common/getSentences'; | |
import getWords from './common/getWords'; | |
import stripSpecialCharacters from './common/stripSpecialCharacters'; | |
/** | |
* Gets the average word length from a page | |
* @param {string} html - the html to process |