Socket
Socket
Sign inDemoInstall

node-github-webhook

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-github-webhook - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

54

index.js

@@ -20,27 +20,2 @@ /**

function create(options) {
function findHandler(url, arr) {
var ret = arr[0]
for (var i = 0; i < arr.length; i++) {
if (url.split('?').shift() === arr[i].path)
ret = arr[i]
}
return ret
}
if (Array.isArray(options)) {
options = findHandler(req.url, options)
}
if (!isObject(options))
throw new TypeError('must provide an options object')
if (typeof options.path !== 'string')
throw new TypeError('must provide a \'path\' option')
if (typeof options.secret !== 'string')
throw new TypeError('must provide a \'secret\' option')
if (Array.isArray(options.events) && options.events.indexOf('*') === -1)
throw new TypeError('must provide an events array')
// make it an EventEmitter, sort of

@@ -62,2 +37,31 @@ handler.__proto__ = EventEmitter.prototype

function findHandler(url, arr) {
var ret = arr[0]
for (var i = 0; i < arr.length; i++) {
if (url.split('?').shift() === arr[i].path)
ret = arr[i]
}
return ret
}
function checkType(options) {
if (!isObject(options))
throw new TypeError('must provide an options object')
if (typeof options.path !== 'string')
throw new TypeError('must provide a \'path\' option')
if (typeof options.secret !== 'string')
throw new TypeError('must provide a \'secret\' option')
if (Array.isArray(options.events) && options.events.indexOf('*') === -1)
throw new TypeError('must provide an events array')
}
if (Array.isArray(options)) {
options = findHandler(req.url, options)
}
checkType(options)
if (req.url.split('?').shift() !== options.path)

@@ -64,0 +68,0 @@ return callback()

{
"name": "node-github-webhook",
"version": "1.0.1",
"version": "1.0.2",
"description": "Github Webhooks handler based on Node.js. Support multiple handlers.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,2 +12,4 @@ # node-github-webhook

Notice: Github Webhooks setting: `Content-type` must be `application/json`.
### Usage

@@ -14,0 +16,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc