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

Statements: 87.1% (27 / 31)      Branches: 50% (5 / 10)      Functions: 100% (5 / 5)      Lines: 87.1% (27 / 31)      Ignored: none     

All files » gulp-livereload-mithril/ » index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55  1 1 1 1 1   1 3         3 3   3     1 3     3     3 3 3     3 3         3 3 3 3     3       3 3         1 1
"use strict";
var Splitter = require('st8less');
var through = require('through2');
var path = require('path');
var gutil = require('gulp-util');
var merge = require('merge');
 
function extractViews(opts) {
    opts = merge({
        dest: "",
        scriptName: "st8less.js",
        split: module.exports.Mithril
    }, opts);
    opts = opts || {};
    opts.dest = path.join(opts.dest, opts.scriptName);
 
    var splitter = new Splitter(opts.split(opts));
 
 
    function extractFromFile(file, enc, cb) {
        Iif (file.isNull()) {
            return cb(null, file);
        }
        Iif (file.isStream()) {
            throw gutil.PluginError("[gulp-split] Does not support streams");
        }
        var src = file.contents.toString('utf8');
        splitter.parse(src, function (err, dst) {
            Iif (err) {
                return cb(err);
            }
            file.contents = new Buffer(dst);
            cb(null, file);
        });
 
 
    }
    return through.obj(extractFromFile, function (cb) {
        var self = this;
        splitter.done(function (err, body) {
            Iif (err) {
                return cb(err);
            }
            var file = new gutil.File({
                path: opts.dest,
                contents: new Buffer(body)
            });
            self.push(file);
            cb();
        });
    });
}
 
module.exports = extractViews;
module.exports.Mithril = require('./mithril.extract');