Created
May 16, 2016 15:06
-
-
Save ashleygwilliams/f9d740813ec9fb36fe146a89ea1e14a1 to your computer and use it in GitHub Desktop.
This file contains 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
// given a certain state, return the value of a variable | |
// STATE: | |
// variables: [a, b, c] | |
// values: { a: 5, b: a, c: 1 } | |
// | |
// value_of: b | |
value_of(variable) { | |
var val_vars = Object.keys(this.values); | |
if (variable.name != 'undefined' && val_vars.indexOf(variable.name) !== -1) { | |
var val = this.values[variable.name] | |
return this.value_of(val); | |
} else { | |
return variable; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment