Code coverage report for gulp-livereload-mithril\mithril.extract.js

Statements: 100% (10 / 10)      Branches: 100% (8 / 8)      Functions: 100% (3 / 3)      Lines: 100% (10 / 10)      Ignored: none     

All files » gulp-livereload-mithril/ » mithril.extract.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  1 1 1 3 3 1   3     1 3   6        
"use strict";
var fs = require('fs');
var path = require('path');
function readPlugin(opts) {
    var plugin = fs.readFileSync(path.join(__dirname, "StatelessReloadPlugin.js"), {encoding: "utf-8"});
    if (opts && opts.scriptName !== 'st8less.js') {
        plugin += "\nMithPlugin.PATTERN = /" + opts.scriptName.replace(/\./g, "\\.") + "$/;\n";
    }
    return plugin;
}
 
module.exports = function (opts) {
    return {
        criteria: function (fn) {
            return (fn.name === 'view' || fn.attribute === '__view' || fn.attribute === '__stateless') && fn.attribute !== '__ignore';
        },
        append: readPlugin(opts) + "\n\nm.redraw();"
    };
};