Skip to content

Instantly share code, notes, and snippets.

@grabcode grabcode/validCandidate.js
Last active Apr 12, 2016

Embed
What would you like to do?
validCandidate function
function validCandidate(languages) {
let validCandidate = false
let languageRegex = /script$/
if(Array.isArray(languages)) {
validCandidate = !!languages.filter( (language)=> languageRegex.test(language) ).length
} else if (typeof languages == 'string') {
validCandidate = languageRegex.test(languages)
}
return validCandidate
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.