@lopatnov/namespace
Dynamic namespace creation
Install
npm install @lopatnov/namespace
Browser
<script src="//lopatnov.github.io/namespace/dist/namespace.min.js"></script>
Import package to the project
TypeScript
import Namespace from "@lopatnov/namespace";
JavaScript
var Namespace = require("@lopatnov/namespace");
How to use
window.globalSpace = new Namespace('Eeny.meeny.miny.moe[Catch][a][tiger][by][the][toe]');
var x = new Namespace('Games.World');
var y = {};
var z = x.goto('Games.World');
x.applyTo(y, 'Hello');
console.log(z === y.Hello.Games.World);
Demo
See, how it's working: https://runkit.com/lopatnov/namespace
Test it with a runkit: https://npm.runkit.com/@lopatnov/namespace
Rights and Agreements
License Apache-2.0
Copyright 2020 Oleksandr Lopatnov