hindimejs
Version:
A programming language with a desi twist. It uses commonly used hindi words for commands.🫡
13 lines (11 loc) • 327 B
JavaScript
const variableResolver = (env, name) => {
let scope = env;
while (scope) {
if (scope.vars && Object.prototype.hasOwnProperty.call(scope.vars, name)) {
return scope.vars[name];
}
scope = scope.parent;
}
throw new ReferenceError(`Unknown variable "${name}"`);
};
module.exports = { variableResolver };