ATTENTION This package is deprecated and is no longer supported. Please, use Isaac's inherits package instead.
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.
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
inheritswork with old browsers
- it contains a lot of unrelated stuff
- it contains the shim for
processglobal, 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.
npm install inh and then use
var inherits = require('inh');
var inherits = require('util').inherits;