JavaScript-logo.png

Detox for Javascript

Requires ES6 / ES2015 and above

 

Quick Start Guide

Before starting, download the latest Detox data file.


The Detox module is UMD compatible and can be imported using the respective syntax from the Javascript platform of choice.

CommonJS / Node.js

const Detox = require('./detox.js');

// Fetch Detox data file and parse JSON - see download page of data file for examples
let detoxData = ...;

// Initialize Moderator and we're good to go!
var moderator = new Detox.Moderator(detoxData);
let message = "Welcome to Detox!";
let results = moderator.isToxic(message);

HTML Script

<script src=".../detox.js"></script> ... <script> // Fetch Detox data file and parse JSON - see download page of data file for examples let detoxData = ...; // Initialize Moderator and we're good to go! var moderator = new Detox.Moderator(detoxData); let message = "Welcome to Detox!"; let results = moderator.isToxic(message); </script>

For more details, see our Overview documentation guide.