inh
v0.0.1
Published
DEPRECATED, see README.md Was: both browser- and node-friendly inherits() for browserify
Downloads
3
Readme
inh
ATTENTION This package is deprecated and is no longer supported. Please, use Isaac's inherits package instead.
The Story
The idea listed below have been moved to inherits package version 2.0 (and above) to have exactly one canonical 'inherits' package and don't confuse people by having two options.
The Idea
inherits for browserify
inherits
function is used in almost every module. It is located in util
package and browserify provides you browser-adapted shim of this package. It's good, but the shim is very large, because:
- it contains polyfill to make
inherits
work with old browsers - it contains a lot of unrelated stuff
- it contains the shim for
process
global, because this unrelated stuff depends on it
browserify produces a lot of supportive code for util
package. It is ok for large projects, but too much for tiny libraries.
inh
is aimed to solve this problem. For node.js it just returns standard inherits
implementation from util
package, but for browserify it provides browser-specific version (using "browser" key in package.json).
It's recommended to use inh
in all your code that can be used on client side.
Usage
npm install inh and then use
var inherits = require('inh');
instead of
var inherits = require('util').inherits;