Skip to content

Instantly share code, notes, and snippets.

@eddiemoore
Last active January 4, 2017 06:42
Show Gist options
  • Select an option

  • Save eddiemoore/00f56137dfd705269670b1da68a721dd to your computer and use it in GitHub Desktop.

Select an option

Save eddiemoore/00f56137dfd705269670b1da68a721dd to your computer and use it in GitHub Desktop.

Revisions

  1. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return false
    return Array.from(elements).every(item => item.validity && item.validity.valid)
    return Array.from(elements).every(elem => elem.validity && elem.validity.valid)
    }
  2. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return false

    return Array.from(elements).every(item => item.validity && item.validity.valid)
    }
  3. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,5 @@ const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return false

    return Array.from(elements)
    .every(item => item.validity && item.validity.valid)
    return Array.from(elements).every(item => item.validity && item.validity.valid)
    }
  4. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,6 @@ const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return false

    const itemsLeft = Array.from(elements)
    .filter(item => item.validity && !item.validity.valid)

    return itemsLeft.length === 0
    return Array.from(elements)
    .every(item => item.validity && item.validity.valid)
    }
  5. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return true
    if (!elements) return false

    const itemsLeft = Array.from(elements)
    .filter(item => item.validity && !item.validity.valid)
  6. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return false
    if (!elements) return true

    const itemsLeft = Array.from(elements)
    .filter(item => item.validity && !item.validity.valid)
  7. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ const isFormValid = form => {
    if (!elements) return false

    const itemsLeft = Array.from(elements)
    .filter(item => !item.validity.valid)
    .filter(item => item.validity && !item.validity.valid)

    return itemsLeft.length === 0
    }
  8. eddiemoore revised this gist Jan 4, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion isFormValid.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,6 @@ const isFormValid = form => {
    if (!elements) return false

    const itemsLeft = Array.from(elements)
    .filter(item => item.required)
    .filter(item => !item.validity.valid)

    return itemsLeft.length === 0
  9. eddiemoore renamed this gist Jan 4, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. eddiemoore created this gist Jan 4, 2017.
    10 changes: 10 additions & 0 deletions isFormValid
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    const isFormValid = form => {
    const elements = form && form.elements
    if (!elements) return false

    const itemsLeft = Array.from(elements)
    .filter(item => item.required)
    .filter(item => !item.validity.valid)

    return itemsLeft.length === 0
    }