sparkbot/webhook.js
function compareWebhooks(webhook, name, targetUrl, resource, event, filter, secret) {
	if ((webhook.name !== name)
	|| (webhook.targetUrl !== targetUrl)
	|| (webhook.resource !== resource)
	|| (webhook.event !== event)) {
		return false;
	}

	// they look pretty identifty, let's check optional fields
	if (filter) {
		if (filter !== webhook.filter) {
			fine("webhook look pretty similar BUT filter is different");
			return false;
		}
	}
	else {
		if (webhook.filter) {
			fine("webhook look pretty similar BUT filter is different");
			return false;
		}
	}

	if (secret) {
		if (secret !== webhook.secret) {
			fine("webhook look pretty similar BUT secret is different");
			return false;
		}
	}
	else {
		if (webhook.secret) {
			fine("webhook look pretty similar BUT secret is different");
			return false;
		}
	}
	return true;
}
function compareWebhooks(webhook, name, targetUrl, resource, event, filter, secret) {
	if ((webhook.name !== name)
	|| (webhook.targetUrl !== targetUrl)
	|| (webhook.resource !== resource)
	|| (webhook.event !== event)) {
		return false;
	}

	// they look pretty identifty, let's check optional fields
	if (filter) {
		if (filter !== webhook.filter) {
			fine("webhook look pretty similar BUT filter is different");
			return false;
		}
	}
	else {
		if (webhook.filter) {
			fine("webhook look pretty similar BUT filter is different");
			return false;
		}
	}

	if (secret) {
		if (secret !== webhook.secret) {
			fine("webhook look pretty similar BUT secret is different");
			return false;
		}
	}
	else {
		if (webhook.secret) {
			fine("webhook look pretty similar BUT secret is different");
			return false;
		}
	}
	return true;
}
function compareWebhooks ( webhook , name , targetUrl , resource , event , filter , secret ) { if ( ( webhook . name !== name ) || ( webhook . targetUrl !== targetUrl ) || ( webhook . resource !== resource ) || ( webhook . event !== event ) ) { return false ; } // they look pretty identifty, let's check optional fields if ( filter ) { if ( filter !== webhook . filter ) { fine ( "webhook look pretty similar BUT filter is different" ) ; return false ; } } else { if ( webhook . filter ) { fine ( "webhook look pretty similar BUT filter is different" ) ; return false ; } } if ( secret ) { if ( secret !== webhook . secret ) { fine ( "webhook look pretty similar BUT secret is different" ) ; return false ; } } else { if ( webhook . secret ) { fine ( "webhook look pretty similar BUT secret is different" ) ; return false ; } } return true ; }
returns true if webhooks are identical
returns true if webhooks are identical