How to use console - 10 common examples

To help you get started, we’ve selected a few console 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 standard-things / esm / test / fixture / scenario / flow-remove-types / main.js View on Github external
// @flow
import { log } from "console"
import test from "./test.js"

const actual: boolean = test()

log("flow-remove-types:" + actual)
github davidflanagan / CoverMonkey / src / NodeApp.js View on Github external
// If file is null here look for a file name with the same basename
            // And alter the target in the array
            if (!file) {
                target = path.basename(target);

                for(var filename in data) {
                    if (path.basename(filename) === target) {
                        target = filename;
                        file = data[filename];
                        options.targets[index] = target;
                        break;
                    }
                }
                if (!file) {
                    console.warn("Unknown target file %s", target);
                    return; 
                }
            }

            var coverage = file.coverage();
            var covered = coverage[0];
            var partial = coverage[1];
            var uncovered = coverage[2];
            var dead = coverage[3];
            var lines = covered + partial + uncovered + dead;

            total.lines += lines;
            total.covered += covered;
            total.partial += partial;
            total.uncovered += uncovered;
            total.dead += dead;
github n-riesco / jp-babel / test / index.js View on Github external
this.socket[socketName].on("message", (function() {
                var message = new jmp.Message(arguments);

                var msg_type = message.header.msg_type;
                if (DEBUG) console.log("Received", msg_type, "on", socketName);

                message.parent_header = message.parentHeader;
                delete message.parentHeader;

                this.messageBuffer[socketName].push(message);

                this._runIfPossible();
            }).bind(this));
        }).bind(this)
github graalvm / graaljs / test / parallel / test-console-group.js View on Github external
function setup() {
  stdout = '';
  hijackStdout(function(data) {
    stdout += data;
  });

  stderr = '';
  hijackStderr(function(data) {
    stderr += data;
  });

  c = new Console(process.stdout, process.stderr);
}
github standard-things / esm / test / fixture / scenario / ts-node / index.ts View on Github external
import { log } from "console"

const actual: boolean = true

log("ts-node:" + actual)
github standard-things / esm / test / fixture / main-hook / options / env-main-fields / index.js View on Github external
import def1 from "main-fields"
import def2 from "main-fields-mjs"
import { log } from "console"

const actual =
  def1 === "module" &&
  def2 === "main"

log("esm-options-main-fields:" + actual)
github arangodb / arangodb / js / server / modules / @arangodb / cluster.js View on Github external
});
      console.debug('waitForSyncRepl', dbName, collName, shards, cinfo.shards, ccinfo);
      var ok = true;
      for (var i = 0; i < shards.length; ++i) {
	if (cinfo.shards[shards[i]].length !== ccinfo[i].length) {
	  ok = false;
	}
      }
      if (ok) {
	console.debug('waitForSyncRepl: OK:', dbName, collName, shards);
	return true;
      }
      require('internal').wait(1);
    }
  } catch (err) {
    console.warn('waitForSyncRepl:', dbName, collName, ': exception', JSON.stringify(err));
  }
  console.warn('waitForSyncRepl:', dbName, collName, ': BAD');
  return false;
}
github arangodb / arangodb / js / server / modules / @arangodb / cluster.js View on Github external
var ok = true;
      for (var i = 0; i < shards.length; ++i) {
	if (cinfo.shards[shards[i]].length !== ccinfo[i].length) {
	  ok = false;
	}
      }
      if (ok) {
	console.debug('waitForSyncRepl: OK:', dbName, collName, shards);
	return true;
      }
      require('internal').wait(1);
    }
  } catch (err) {
    console.warn('waitForSyncRepl:', dbName, collName, ': exception', JSON.stringify(err));
  }
  console.warn('waitForSyncRepl:', dbName, collName, ': BAD');
  return false;
}
github davidflanagan / CoverMonkey / src / NodeApp.js View on Github external
stream.on('end', function() {
        if (fragment != "") {
            var consumed = parser.processLine(fragment);
            if (!consumed && stream === process.stdin && options.echo) {
                console.log(fragment);
            }
        }

        if (parser.scripts.length === 0) {
            console.log("CoverMonkey: No coverage data to process.\n" +
                        "CoverMonkey: Are you using a debug build of spidermonkey?");
            process.exit(0);
        }

        callback(parser.scripts);
    });
}
github surmon-china / nodepress / src / todos / github.controller.bak.js View on Github external
forks: rep.forks,
                forks_count: rep.forks_count,
                description: rep.description || ' ',
                open_issues_count: rep.open_issues_count,
                stargazers_count: rep.stargazers_count,
                created_at: rep.created_at,
                language: rep.language
              }
            })
            return resolve(peojects)
          } catch (error) {
            console.warn('github 控制器解析为 JSON 失败', body)
            return reject(body)
          }
        } else {
          console.warn('项目列表获取失败', 'err:', err, 'body:', body)
          return reject(err)
        }
      })
    })

console

Returns `console` if present, otherwise returns a `noop`.

MIT
Latest version published 7 years ago

Package Health Score

54 / 100
Full package analysis