paypal / AATT

Automated Accessibility Testing Tool
BSD 3-Clause "New" or "Revised" License
602 stars 106 forks source link

Use as node module #46

Closed samboylett closed 5 years ago

samboylett commented 5 years ago

Addresses https://github.com/paypal/AATT/issues/45

This lets you use the project as a node module, without the need for running it separately and using the web API.

Example usage:

const { evaluate } = require('aatt');

evaluate({
    source: "<html xml:lang='en-gb'><head><title>foo</title></head><body><p>bar</p></body></html>",
    output: "json",
    engine: "htmlcs",
    level: "WCAG2A"
}).then(result => {
    console.log(JSON.parse(result));
});

I have bumped the minor version and set the main to the module.js. Running the project as a node/express website is unaffected by these changes, although the evaluate endpoint uses the module function now.