https://github.com/doowb/typeof-github-event
Detect the type of github webhook events.
https://github.com/doowb/typeof-github-event
Last synced: about 1 year ago
JSON representation
Detect the type of github webhook events.
- Host: GitHub
- URL: https://github.com/doowb/typeof-github-event
- Owner: doowb
- License: mit
- Created: 2016-02-17T19:53:46.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-19T04:01:26.000Z (about 9 years ago)
- Last Synced: 2025-04-28T22:08:51.447Z (over 1 year ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typeof-github-event [](https://www.npmjs.com/package/typeof-github-event) [](https://npmjs.org/package/typeof-github-event) [](https://npmjs.org/package/typeof-github-event) [](https://travis-ci.org/doowb/typeof-github-event) [](https://ci.appveyor.com/project/doowb/typeof-github-event)
> Detect the type of github webhook events.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save typeof-github-event
```
Install with [yarn](https://yarnpkg.com):
```sh
$ yarn add typeof-github-event
```
## Usage
```js
var events = require('typeof-github-event');
```
### .typeof
Get the type of github event based on the given payload.
```js
var type = events.typeof(payload);
console.log(type);
//=> commit_comment
```
### .is
Check if the payload is a the given event type.
```js
if (events.is('commit_comment', payload)) {
console.log('commit_comment');
}
```
### .is{Event}
Checks if the payload is the specific event type.
```js
if (events.isCommitComment(payload)) {
console.log('commit_comment');
}
```
## About
### Related projects
* [github-base](https://www.npmjs.com/package/github-base): JavaScript wrapper that greatly simplifies working with GitHub's API. | [homepage](https://github.com/jonschlinkert/github-base "JavaScript wrapper that greatly simplifies working with GitHub's API.")
* [githubbot](https://www.npmjs.com/package/githubbot): Starting point for registering event handlers and handling payloads coming from github webhooks. Allows usage… [more](https://github.com/doowb/githubbot) | [homepage](https://github.com/doowb/githubbot "Starting point for registering event handlers and handling payloads coming from github webhooks. Allows usage of plugins to extend functionality for individual implementations.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
### Author
**Brian Woodward**
* [github/doowb](https://github.com/doowb)
* [twitter/doowb](https://twitter.com/doowb)
### License
Copyright © 2017, [Brian Woodward](https://github.com/doowb).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 18, 2017._