Skip to content

tunnckoCore/is-emitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

3 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Check that given value is EventEmitter, not so strict as is-node-emitter.

code climate standard code style travis build status coverage status dependency status

Install

npm i is-emitter --save

Usage

For more use-cases see the tests

var isEmitter = require('is-emitter')

return true for emitters and streams

var fs = require('fs')
var cp = require('child_process')
var DualEmitter = require('dual-emitter')

isEmitter(process)
isEmitter(process.stdin)
isEmitter(process.stdout)
isEmitter(cp.exec('echo hello world'))
isEmitter(fs.createReadStream('./index.js'))
isEmitter(DualEmitter())

return false otherwise

function Func () {}

isEmitter(1234)
isEmitter(['a'])
isEmitter(/regex/)
isEmitter({a: 'b'})
isEmitter(function () {})
isEmitter(new Func())
isEmitter(new Date())

Related

  • component-emitter: Event emitter
  • dual-emitter: šŸ¹ EventEmitter done right and no dependencies. For nodejs and the browser (>= IE8). Can… more
  • is-node-emitter: Strictly checks that given value is nodejs EventEmitter. It's easy, because his API is in… more

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

About

🐈 Check that given value is EventEmitter, not so strict as `is-node-emitter`.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published