.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / unherit / readme.md
1 # unherit
2
3 [![Build][build-badge]][build]
4 [![Coverage][coverage-badge]][coverage]
5 [![Downloads][downloads-badge]][downloads]
6 [![Size][size-badge]][size]
7
8 Create a custom constructor which can be modified without affecting the original
9 class.
10
11 ## Install
12
13 [npm][]:
14
15 ```sh
16 npm install unherit
17 ```
18
19 ## Use
20
21 ```js
22 var EventEmitter = require('events').EventEmitter
23 var unherit = require('unherit')
24
25 // Create a private class which acts just like `EventEmitter`.
26 var Emitter = unherit(EventEmitter)
27
28 Emitter.prototype.defaultMaxListeners = 0
29 // Now, all instances of `Emitter` have no maximum listeners, without affecting
30 // other `EventEmitter`s.
31
32 new Emitter().defaultMaxListeners === 0 // => true
33 new EventEmitter().defaultMaxListeners === undefined // => true
34 new Emitter() instanceof EventEmitter // => true
35 ```
36
37 ## API
38
39 ### `unherit(Super)`
40
41 Create a custom constructor which can be modified without affecting the original
42 class.
43
44 ###### Parameters
45
46 *   `Super` (`Function`) — Super-class
47
48 ###### Returns
49
50 `Function` — Constructor acting like `Super`, which can be modified without
51 affecting 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