em extends few core NodeJS modules with
simpler object oriented interface and immutable objects.
It can be installed directly from NPM:
npm install em
Open source, MIT-style license.
You can create instances of
URL by calling
URL.create() only creates new objects when it must. For
example when called with an another instance of
URL it can simply
return it since it's immutable and cannot be changed.
Each method of
URL returns an another URL object so you can chain its
var url = URL;console;
One of the coolest features of
URL is that parsing can be done just
in time on demand. In the previous example the URL wasn't parsed until
url.href! However if you need you can call
url.parse() and get a real object with no magic members and JIT.
Path works the same way.
You can create objects by calling
new Path('/foo/bar'). Paths are immutable, too.
var path = Path;console; // Returns '/foo/bar/docroot'console; // Returns 'index'
At the moment for further details please take a look at tests.