Skip to content

Instantly share code, notes, and snippets.

@Nolski
Last active October 29, 2015 19:08
Show Gist options
  • Save Nolski/951f768ee07109210f6a to your computer and use it in GitHub Desktop.
Save Nolski/951f768ee07109210f6a to your computer and use it in GitHub Desktop.
import { getVariable } from 'utils'
...
let foo = getVariable(context, 'foo');
console.log(foo); // undefined
export function getVariable(context, name) {
var variables = context.getScope().variables;
variables.forEach(function (variable) {
if (variable.name === name) {
console.log(variable) // { name: 'foo', ... }
return variable;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment