UNPKG

553 BJavaScriptView Raw
1#!/bin/env node
2
3var repl = require('repl');
4var ctx = repl.start('>> ').context;
5
6var htmllint = require('./');
7
8// export stuff to use in the repl
9ctx.htmllint = htmllint;
10
11ctx.lint = function () {
12 var promise = ctx.htmllint.apply(ctx.htmllint, arguments);
13
14 function handler(result) {
15 ctx['_'] = result;
16
17 console.log(result);
18 console.log('You can access the results in the "_" obj');
19 }
20
21 promise.then(handler, handler);
22};
23
24
25var parser = ctx.htmllint.defaultLinter.parser;
26ctx.parse = parser.parse.bind(parser);