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

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.

Awesome Lists containing this project

README

          

# typeof-github-event [![NPM version](https://img.shields.io/npm/v/typeof-github-event.svg?style=flat)](https://www.npmjs.com/package/typeof-github-event) [![NPM monthly downloads](https://img.shields.io/npm/dm/typeof-github-event.svg?style=flat)](https://npmjs.org/package/typeof-github-event) [![NPM total downloads](https://img.shields.io/npm/dt/typeof-github-event.svg?style=flat)](https://npmjs.org/package/typeof-github-event) [![Linux Build Status](https://img.shields.io/travis/doowb/typeof-github-event.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/typeof-github-event) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/typeof-github-event.svg?style=flat&label=AppVeyor)](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._