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

webpurify

v2.1.0

Published

This provides an easy module for interacting with the WebPurify API

Downloads

2,813

Readme

WebPurify API for Node.js

npm version Build Status

This module allows simple interaction with the WebPurify API within Node.js. For more information about WebPurify and the services it offers, check out http://webpurify.com/.

Commands

Filters
Blacklist
Whitelist
Image Moderation

Install & Initialize

npm install webpurify

To initialize:

// ES6
import WebPurify from 'webpurify';

// Otherwise
const WebPurify = require('webpurify');

const wp = new WebPurify({
    api_key: ENV['WEBPURIFY_API_KEY']
    //, endpoint:   'us'  // Optional, available choices: 'eu', 'ap'. Default: 'us'.
    //, enterprise: false // Optional, set to true if you are using the enterprise API, allows SSL
});

Commands

check

Check a string of text for profanity. Returns true if profanity found, false if none.

wp.check('some profane text')
.then(profanity => {
  if (profanity) {
    console.log('A bunch of sailors in here!');
  } else {
    console.log('This is a pure string');
  }
});

checkCount

Check a string of text for profanity. Returns number of words if profanity found, 0 if none.

wp.checkCount('some profane text')
.then(profanity => {
  if (profanity > 0) {
    console.log(profanity.toString() + ' sailors in here!');
  } else {
    console.log('This is a pure string');
  }
});

replace

Check a string of text for profanity. Replaces any found profanity with a provided symbol, and returns the formatted string.

wp.replace('some profane text', '*')
.then(purifiedText => {
  console.log(purifiedText);
});

return

Check a string of text for profanity. If any found, returns an array of profane words. Else, returns empty array.

wp.return('some profane text')
.then(profanity => {
  for (word in profanity) {
    console.log(profanity[word]);
  }
});

Options

All filter commands can take an additional options object, just before the callback. The available options are:

var optional = {
  lang:   'en', // the 2 letter language code for the text you are submitting
  semail: 1,    // treat email addresses like profanity
  sphone: 1,    // treat phone numbers like profanity
  slink:  1     // treat urls like profanity
};

wp.check('some profane text', optional)
.then(profanity => {
  console.log(profanity);
});

addToBlacklist

Add a word to the blacklist.

wp.addToBlacklist('my_word')
.then(success => {
  if (success) { console.log('success!'); }
});

Can also be called without callback:

wp.addToBlacklist('my_word');

For Deep search, add optional parameter 1 after word:

wp.addToBlacklist('my_word', 1);

removeFromBlacklist

Remove a word from the blacklist.

wp.removeFromBlacklist('my_word')
.then(success => {
  if (success) { console.log('success!'); }
});

Can also be called without callback:

wp.removeFromBlacklist('my_word');

getBlacklist

Get the blacklist as an array of words.

wp.getBlacklist()
.then(blacklist => {
  for (word in blacklist) {
    console.log(blacklist[word]);
  }
});

addToWhitelist

Add a word to the whitelist.

wp.addToWhitelist('my_word')
.then(success => {
  if (success) { console.log('success!'); }
});

Can also be called without callback:

wp.addToWhitelist('my_word');

removeFromWhitelist

Remove a word from the whitelist.

wp.removeFromWhitelist('my_word')
.then(success => {
  if (success) { console.log('success!'); }
});

Can also be called without callback:

wp.removeFromWhitelist('my_word');

getWhitelist

Get the whitelist as an array of words.

wp.getWhitelist()
.then(whitelist => {
  for (word in whitelist) {
    console.log(whitelist[word]);
  }
});

Image Moderation

imgCheck

Use this method to submit an image to the moderation service. It will return an image ID that is used to return the results of the moderation to a callback function.

wp.imgCheck('http://imageURL...')
.then((imgid) => {
  // this imgid could be used to check the status later
});

imgStatus

Returns the moderation status of an image. Possible results can be: pending, approved, declined.

wp.imgStatus('imgid')
.then((status) => {
  // this is the status of your moderation
});

imgAccount

Check the number of image submissions remaining on your license.

wp.imgAccount()
.then((remaining) => {
  // this is how many subscriptions you have to use
});

aimImgCheck

Use this method to submit an image to the WebPurify Automated Intelligent Moderation (AIM) Service. A percentage probability that the submitted image contains nudity will be returned in real-time.

wp.aimImgCheck('http://imageURL...')
.then((nudity) => {
  if (nudity > 95) {
      console.log('there\'s probably some nudity going on');
  }
});

aimImgAccount

Check the number of AIM image submissions remaining on your license.

wp.aimImgAccount()
.then((remaining) => {
  // this is how many subscriptions you have to use
});

hybridImgCheck

Combine our Automated Intelligent Moderation system (AIM) and our Live moderators to create a powerful low cost solution.

Images submitted to this method, are first sent to AIM and then sent to our live moderation team based on thresholds you set.

I.E any image that is given a 50% or greater probability by AIM can then be sent to our human moderation team for further review.

wp.hybridImgCheck('http://imageURL...')
.then((nudity) => {
  if (nudity > 55) {
      console.log('Maybe there\'s nudity');

      // use the customimgid parameter to poll for the live check
  }
});