JS utility to create and use a namespacing pattern