How to use raptor-util - 10 common examples

To help you get started, we’ve selected a few raptor-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lasso-js / lasso / lib / writers / FileWriter.js View on Github external
},

    getFileOutputStream: function(file) {
        return fs.createWriteStream(file, {encoding: 'utf8'});
    },
    
    setUrlBuilder: function(urlBuilder) {
        this.urlBuilder = urlBuilder;
    },
    
    getUrlBuilder: function() {
        return this.urlBuilder;
    }
};

require('raptor-util').inherit(FileWriter, Writer);

module.exports = FileWriter;
github marko-js / marko / taglibs / core / WhenNode.js View on Github external
var test = this.getProperty('test');
        if (!test) {
            this.addError('"test" attribute is required for ' + this.toString() + ' tag.');
        }
        var ifCode = 'if (' + test + ')';
        if (!this.firstWhen) {
            template.line('else ' + ifCode + ' {');
        } else {
            template.statement(ifCode + ' {');
        }
        template.indent(function () {
            this.generateCodeForChildren(template);
        }, this).line('}');
    }
};
require('raptor-util').inherit(WhenNode, require('../../compiler').Node);
module.exports = WhenNode;
github marko-js / marko / taglibs / core / ElseNode.js View on Github external
ElseNode.$super.call(this, 'c-else');
    if (props) {
        this.setProperties(props);
    }
}
ElseNode.prototype = {
    doGenerateCode: function (template) {
        if (this.valid == null) {
            return;    //Don't generate code for an invalid else
        }
        template.line('else {').indent(function () {
            this.generateCodeForChildren(template);
        }, this).line('}');
    }
};
require('raptor-util').inherit(ElseNode, require('../../compiler').ElementNode);
module.exports = ElseNode;
github marko-js / marko / taglibs / core / ScriptletNode.js View on Github external
'use strict';
function ScriptletNode(code) {
    ScriptletNode.$super.call(this, 'scriptlet');
    this.code = code;
}
ScriptletNode.prototype = {
    doGenerateCode: function (template) {
        if (this.code) {
            template.code(this.code);
        }
    },
    toString: function () {
        return '{%' + this.code + '%}';
    }
};
require('raptor-util').inherit(ScriptletNode, require('../../compiler').Node);
module.exports = ScriptletNode;
github marko-js / marko / taglibs / core / OtherwiseNode.js View on Github external
OtherwiseNode.$super.call(this);
    if (props) {
        this.setProperties(props);
    }
}
OtherwiseNode.prototype = {
    doGenerateCode: function (template) {
        template.line('else {').indent(function () {
            this.generateCodeForChildren(template);
        }, this).line('}');
    },
    toString: function () {
        return '';
    }
};
require('raptor-util').inherit(OtherwiseNode, require('../../compiler').Node);
module.exports = OtherwiseNode;
github marko-js / marko / taglibs / core / AssignNode.js View on Github external
var value = this.getProperty('value');
        if (!varName) {
            this.addError('"var" attribute is required');
        } else if (!varNameRegExp.test(varName)) {
            this.addError('Invalid variable name of "' + varName + '"');
            varName = null;
        }
        if (!value) {
            this.addError('"value" attribute is required');
        }
        if (varName) {
            template.statement(varName + '=' + value + ';');
        }
    }
};
require('raptor-util').inherit(AssignNode, require('../../compiler').Node);
module.exports = AssignNode;
github lasso-js / lasso / src / BundleMappings.js View on Github external
},

    toString: function() {
        var lines = [];
        for (var k in this.dependencyToBundleMapping) {
            if (this.dependencyToBundleMapping.hasOwnProperty(k)) {
                var targetBundle = this.dependencyToBundleMapping[k].bundle;
                lines.push(k + ' --> ' + targetBundle.toString());
            }
        }

        return lines.join('\n');
    }
};

require('raptor-util').inherit(BundleMappings, EventEmitter);

module.exports = BundleMappings;
github patrick-steele-idem / browser-refresh / lib / Launcher.js View on Github external
} else {
            this.fork();
        }
    },

    start: function(port) {
        this.port = port;
        this.restart();
    },

    isStarted: function() {
        return this.state === 'started';
    }
};

require('raptor-util').inherit(Launcher, EventEmitter);

module.exports = Launcher;
github lasso-js / lasso / src / writers / Writer.js View on Github external
}
        });

        return promise;
    },

    buildResourceCacheKey(cacheKey, lassoContext) {
        if (this.impl.buildResourceCacheKey) {
            return this.impl.buildResourceCacheKey(cacheKey, lassoContext);
        } else {
            return cacheKey;
        }
    }
};

require('raptor-util').inherit(Writer, EventEmitter);

module.exports = Writer;
github patrick-steele-idem / browser-refresh / lib / Watcher.js View on Github external
_this.emit('modified', {
                        type: event,
                        path: path
                    });
                });
            });
    }

    this.start = start;
}

Watcher.prototype = {
};

require('raptor-util').inherit(Watcher, EventEmitter);

module.exports = Watcher;

raptor-util

Core utitility functions for RaptorJS

Apache-2.0
Latest version published 8 years ago

Package Health Score

48 / 100
Full package analysis

Popular raptor-util functions

Similar packages