Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaelzhang/node-util-inherits

node util.inherits with compatibility
https://github.com/kaelzhang/node-util-inherits

inherits node utility

Last synced: 2 months ago
JSON representation

node util.inherits with compatibility

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/kaelzhang/node-util-inherits.svg?branch=master)](https://travis-ci.org/kaelzhang/node-util-inherits)

# util-inherits

util.inherits with compatibility.

`util-inherits` will try use `Object.setPrototypeOf`, if `Object.setPrototypeOf` is not supported, then `Object.create`, or manipulate prototype.

- Browser friendly.
- Does not rely on node utilities

## Install

```sh
$ npm install util.inherits --save
```

## Usage

```js
const inherits = require('util.inherits')
const {EventEmitter} = require('events')

function MyClass () {
// code ...
}

inherits(MyClass, EventEmitter)
```

## License

MIT