1# unherit 2 3[![Build][build-badge]][build] 4[![Coverage][coverage-badge]][coverage] 5[![Downloads][downloads-badge]][downloads] 6[![Size][size-badge]][size] 7 8Create a custom constructor which can be modified without affecting the original 9class. 10 11## Install 12 13[npm][]: 14 15```sh 16npm install unherit 17``` 18 19## Use 20 21```js 22var EventEmitter = require('events').EventEmitter 23var unherit = require('unherit') 24 25// Create a private class which acts just like `EventEmitter`. 26var Emitter = unherit(EventEmitter) 27 28Emitter.prototype.defaultMaxListeners = 0 29// Now, all instances of `Emitter` have no maximum listeners, without affecting 30// other `EventEmitter`s. 31 32new Emitter().defaultMaxListeners === 0 // => true 33new EventEmitter().defaultMaxListeners === undefined // => true 34new Emitter() instanceof EventEmitter // => true 35``` 36 37## API 38 39### `unherit(Super)` 40 41Create a custom constructor which can be modified without affecting the original 42class. 43 44###### Parameters 45 46* `Super` (`Function`) — Super-class 47 48###### Returns 49 50`Function` — Constructor acting like `Super`, which can be modified without 51affecting the original class. 52 53## License 54 55[MIT][license] © [Titus Wormer][author] 56 57<!-- Definitions --> 58 59[build-badge]: https://img.shields.io/travis/wooorm/unherit.svg 60 61[build]: https://travis-ci.org/wooorm/unherit 62 63[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/unherit.svg 64 65[coverage]: https://codecov.io/github/wooorm/unherit 66 67[downloads-badge]: https://img.shields.io/npm/dm/unherit.svg 68 69[downloads]: https://www.npmjs.com/package/unherit 70 71[size-badge]: https://img.shields.io/bundlephobia/minzip/unherit.svg 72 73[size]: https://bundlephobia.com/result?p=unherit 74 75[npm]: https://docs.npmjs.com/cli/install 76 77[license]: license 78 79[author]: https://wooorm.com 80