Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces can be shadowed by data #23

Closed
jeremyruppel opened this issue Mar 5, 2014 · 1 comment · Fixed by #24
Closed

Namespaces can be shadowed by data #23

jeremyruppel opened this issue Mar 5, 2014 · 1 comment · Fixed by #24
Labels

Comments

@jeremyruppel
Copy link
Contributor

Right now, because express-state keeps namespaces separate from their data, it is possible that data can shadow previously defined namespaces. Given some exposed variables like:

expose('foo', {});
expose('foo.bar.baz', 'baz');

The resulting javascript looks like:

root.foo || (root.foo = {});
root.foo.bar || (root.foo.bar = {});

root.foo = {};
root.foo.bar.baz = "baz";

And the root.foo.bar namespace gets shadowed by the data in root.foo.

@ericf
Copy link
Collaborator

ericf commented Mar 6, 2014

I see, the resulting code will throw because root.foo.bar will be undefined when it tries to assign a value to root.foo.bar.baz.

@ericf ericf closed this as completed in #24 Mar 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants