Add NPM definitions

Add definitions for NPM package.
Include tests