mirror of
https://github.com/nodejs/node.git
synced 2026-12-06 10:18:46 -05:00
* install eslint-plugin-markdown * add doc/.eslintrc.yaml * add `<!-- eslint-disable rule -->` or `<!-- eslint-disable -->` for the rest of problematic code * .js files in doc folder added to .eslintignore * update Makefile and vcbuild.bat PR-URL: https://github.com/nodejs/node/pull/12563 Refs: https://github.com/nodejs/node/pull/12557#issuecomment-296015032 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
1.5 KiB
1.5 KiB
unherit

Create a custom constructor which can be modified without affecting the original class.
Installation
npm:
npm install unherit
Usage
var EventEmitter = require('events').EventEmitter;
/* Create a private class which acts just like
* `EventEmitter`. */
var Emitter = unherit(EventEmitter);
Emitter.prototype.defaultMaxListeners = 0;
/* Now, all instances of `Emitter` have no maximum
* listeners, without affecting other `EventEmitter`s. */
assert(new Emitter().defaultMaxListeners === 0); // true
assert(new EventEmitter().defaultMaxListeners === undefined); // true
assert(new Emitter() instanceof EventEmitter); // true
API
unherit(Super)
Create a custom constructor which can be modified without affecting the original class.
Parameters
Super(Function) — Super-class.
Returns
Function — Constructor acting like Super, which can be modified
without affecting the original class.