How to use the util.print function in util

To help you get started, we’ve selected a few 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 nodekit-io / nodekit-darwin / test / lib-test / spec-node / utilSpec.js View on Github external
it('should pass testPrint', function() {
    // only assures we don't fail - doesn't test the actual result
    util.print('message to stdout', 'and', {});
  });
github atlefren / sosi.js / dist / SOSI_lite.js View on Github external
function convert(data, format) {
        var json = parser.parse(data).dumps(format);
        return JSON.stringify(json); /* only for GeoJSON or TopoJSON */
    }

    var data = fs.readFileSync(filename, "utf8");

    var encoding = data.substring(0, 500).match(/TEGNSETT.*/).toString();
    encoding = encoding.split(/\s+/)[1].match(/\S+/).toString(); //sprit at white space, trim
    if (encoding && encoding !== "UTF8") { /* if unlike UTF8, we need iconv, but only then */
        var Iconv = require("iconv").Iconv; /* needed for non UTF8 encodings */
        var converter = new Iconv(encoding, "UTF-8");
        data = fs.readFileSync(filename, encoding = null);
        data = converter.convert(data).toString();
    }
    util.print(convert(data, format));
}
github HamidMosalla / FreelancerBlog / WebFor / src / WebFor.Web / node_modules / gulp-uglify / node_modules / uglify-js / tmp / test-smart.js View on Github external
#! /usr/bin/env node

var U = require("../tools/node.js");
var fs = require("fs");
var code = fs.readFileSync(process.argv[2], "utf8").replace(/^\s*#.*/, "");
var sys = require("util");

var ast = U.parse(code);

ast = ast.smart_normalize();
sys.print(ast.print_to_string({ beautify: true, ascii_only: true }));
sys.print("\n---\n");

var defun = null;
try { ast.walk(new U.TreeWalker(function(node){
    if (node instanceof U.AST_Lambda) throw defun = node;
})) } catch(ex){};

defun.smart_annotate_cfg([]);

defun.walk(new U.TreeWalker(function(node){
    if (node instanceof U.AST_Definitions) return true;
    if (!node.smart_info) {
        sys.print("*****", node.print_to_string({}), "*****");
    } else {
        sys.print(show(node) + " → [" + node.smart_info.next.map(show).join(" # ") + "] ← [" + node.smart_info.prev.map(show).join(" # ") + "]");
    }
    sys.print("\n");
github kirm / sip.js / test / 2_2_6_1.js View on Github external
sendSocket.on('end', function() {
  sendSocket.end();
  transport.destroy();
  util.print('PASSED\n');
});
github linkeddata / rdflib.js / test / tc0007 / test_UUU.js View on Github external
  var alert = function (s) { util.print('alert:' + s + '\n') }
  var kludgeForOfflineUse = function kludgeForOfflineUse (uri) {
github Kami / node-yubico / example / example.js View on Github external
func.call(yubico, args, function(err, success) {
    if (err) {
        util.print('Token validation failed: ' + err.message);
        return;
    }

    util.print('Success, the provided token is valid!');
});
github noblesamurai / noblerecord / nrec.js View on Github external
function usage() {
		if (command == undefined || command == '-h') {
			util.print("Usage: nrec COMMAND [ARGS]\n");
			util.print("\n");
			util.print("The following commands are supported:\n");
			util.print(" init            Create default configuration from template.\n");
			util.print(" generate        Create a new migration or recreate the schema.\n");
			util.print(" migrate         Run all migrations, or one at a time.\n");
			util.print(" load schema     Load the entire schema file, and mark all migrations as run.\n");
			util.print("\n");
			util.print("All commands can be run with -h for more information.\n");
			util.print("\n");
		} else if (command == 'init') {
			util.print("Usage: nrec init\n");
			util.print("\n");
			util.print("Creates the following paths in the current working directory:\n");
			util.print("  ./db/\n");
			util.print("  ./db/migrate/\n");
			util.print("  ./db/config.js\n");
			util.print("\n");
		} else if (command == 'generate') {
			util.print("Usage: nrec generate [generator] [arguments]\n");
			util.print("\n");
			util.print("The following generators are supported:\n");
github noblesamurai / noblerecord / nrec.js View on Github external
if (command == undefined || command == '-h') {
			util.print("Usage: nrec COMMAND [ARGS]\n");
			util.print("\n");
			util.print("The following commands are supported:\n");
			util.print(" init            Create default configuration from template.\n");
			util.print(" generate        Create a new migration or recreate the schema.\n");
			util.print(" migrate         Run all migrations, or one at a time.\n");
			util.print(" load schema     Load the entire schema file, and mark all migrations as run.\n");
			util.print("\n");
			util.print("All commands can be run with -h for more information.\n");
			util.print("\n");
		} else if (command == 'init') {
			util.print("Usage: nrec init\n");
			util.print("\n");
			util.print("Creates the following paths in the current working directory:\n");
			util.print("  ./db/\n");
			util.print("  ./db/migrate/\n");
			util.print("  ./db/config.js\n");
			util.print("\n");
		} else if (command == 'generate') {
			util.print("Usage: nrec generate [generator] [arguments]\n");
			util.print("\n");
			util.print("The following generators are supported:\n");
			util.print(" migration [name]      Generate a new migration with the given file identifier.\n");
			util.print(" schema:               Creates or recreates the current schema specification.\n");
			util.print("\n");

		} else if (command == 'migrate') {
			util.print("Usage: nrec migrate [dir]\n");
			util.print("\n");
			util.print("If no direction is supplied, runs all unraised migrations.\n");
			util.print("With a direction, runs a single migration:\n");
github MarkAYoder / BeagleBoard-exercises / etch-a-sketch / etch-a-sketch.js View on Github external
function printGrid(grid) {
	util.print('   0 1 2 3 4 5 6 7\n');
	for (var i = 0; i < grid.length; i++) {
		util.print(util.format("%d: ", i));
		for (var j = 0; j < grid[i].length; j++) {
			util.print(util.format("%s ", grid[i][j]));
		}
		util.print("\n");
	}
}
github xeolabs / scenejs / build.js View on Github external
process.argv.forEach(function (val, index, array) {

        if (val == "--help") {
            sys.print('SceneJS Build Script\n');
            sys.print('Usage:\n');
            sys.print('build [type] [options]\n');
            sys.print('eg building scripts without documentation,\n build SCRIPTS --without-documents\n');
            sys.print('\n');
            sys.print('Types:\n');
            sys.print('all - (DEFAULT) build all options\n');
            sys.print('scripts - build the compiled script and uglify\n');
            sys.print('docs - build documents\n');
            sys.print('dev - build development template\n');
            sys.print('\n');
            sys.print('Options:\n');
            sys.print('--without-uglify  : builds without using the uglify JS compiler\n');
            sys.print('--without-documents  : (DEFAULT) builds without creating docs using the node-jsdoc-toolkit\n');
            sys.print('\n');
            sys.print('--with-uglify  : (DEFAULT) builds using the uglify JS compiler\n');
            sys.print('--with-documents  : builds the docs using the node-jsdoc-toolkit\n');
            isHelp = true;
            return;
        }

        if (FLAGS[val]) {
            FLAGS = FLAGS[val];