npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-akismet

v0.0.2

Published

Integration with Akismet spam filtering for node.js

Downloads

6

Readme

#node-akismet

Integration with Akismet spam filtering for node.js

Installation

npm install node-akismet

Tests

AKISMET_API=abc123abc123 npm test

For the tests to pass, you need a valid akismet api key. You can add it to the command line as shown above, or hardcode it into test/akismet_test.js if you prefer.

There is no test api key for akismet, you can get a valid api key for free at https://akismet.com/signup/

Usage Overview

var akismet_options = {
    apikey: 'abc123abc123', // required: your akismet api key
    blog: 'http://www.testhost.com', // required: your root level url
    headers:  // optional, but akismet likes it if you set this 
    { 
		'User-Agent': 'testhost/1.0 | node-akismet/0.0.1'
	}
};

Akismet = require('../lib/akismet')(akismet_options);

Akismet.isSpam(args, function(isSpam) {
	if (isSpam) {
		// quarantine that
		console.log('we gots spammed');
	}
	else {
		// continue about your business
		console.log('all good, carry on');
	}
}

API Overview

Akismet = require('../lib/akismet')(akismet_options);

takes a list of parameters:

  • apikey: - requred: your api key from Akismet
  • blog: - required: your top-level url, including the http://
  • headers: - optional: the only header Akismet seems to care about is 'User-Agent', see the bottom of http://akismet.com/development/api/ for the format they prefer

Akismet.isSpam(args, cb)

calls cb() with the truth value of the api call to Akismet.

Throws an Error if Akismet returns anything besides true or false (usually happens when key or args are invalid)

valid args keys are:

var args = ['blog',
			'user_ip',
			'user_agent',
			'referrer',
			'permalink',
			'comment_type',
			'comment_author',
			'comment_author_email',
			'comment_author_url',
			'comment_content'];

you can see documentation for what each should be here: http://akismet.com/development/api/#comment-check

the blog value is optional if you set it in the constructor.

Akismet.verifyKey(args, cb)

test call to ensure your api key is valid, used in automated test, usually does not need to be called from your application code. args is completely optional, if you set apikey and blog values in the constructor.

##Todo

implement submitSpam and submitHam methods