Skip to content

Instantly share code, notes, and snippets.

@nkohari
Created November 27, 2010 15:04
Show Gist options
  • Save nkohari/717959 to your computer and use it in GitHub Desktop.
Save nkohari/717959 to your computer and use it in GitHub Desktop.
namespace = (ns) ->
scope = this
tokens = ns.split('.')
passed = []
for token in tokens
passed.push(token)
scope = scope[token] ?= { __namespace: passed.join('.') }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment