Skip to content

Instantly share code, notes, and snippets.

@fogonthedowns
Created May 1, 2015 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogonthedowns/d7a1ddb28129c82fad0c to your computer and use it in GitHub Desktop.
Save fogonthedowns/d7a1ddb28129c82fad0c to your computer and use it in GitHub Desktop.
example
warnValidations: function(value) {
this.setState({warnErrorTypes:[]})
if (value["fact_interviews"] == "0") {
this.setWarnTypes(2)
} else if (Number(value["fact_interviews"]) >= 20) {
this.setWarnTypes(3)
}
console.log(this.state.warnErrorTypes)
},
setWarnTypes:function(type){
var warnErrorTypes = this.state.warnErrorTypes
warnErrorTypes.push(type)
warnErrorTypes = this.toUnique(warnErrorTypes)
this.setState({ warnErrorTypes: warnErrorTypes })
},
toUnique:function(a,b,c){//array,placeholder,placeholder
b=a.length;
while(c=--b)while(c--)a[b]!==a[c]||a.splice(c,1);
return a // not needed ;)
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment