How to use has-unicode - 1 common examples

To help you get started, we’ve selected a few has-unicode 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 forivall / tacoscript / packages / tacoscript / src / repl / index.js View on Github external
export function start(opts = {}) {
  const [major, minor] = process.versions.node.split('.').map(n => parseInt(n));

  if (major === 0 && minor < 8) {
    console.warn('Node 0.8.0+ required for CoffeeScript REPL');
    // TODO: callback instead
    process.exit(1);}

  if (opts.historyFile == null && process.env.HOME) {
    opts.historyFile = path.join(process.env.HOME, '.taco_history');}
  if (opts.historyMaxInputSize == null) {
    opts.historyMaxInputSize = 10240;}

  const repl = nodeREPL.start({ 
    prompt: hasUnicode() ? '🌮  > ' : 'taco> ', 
    ...opts, 
    eval(input, context, filename, cb) {
      // XXX: multiline hack.
      input = input.replace(/\uFF00/g, '\n');
      return opts.eval(input, context, filename, cb);} });


  repl.on('exit', function () {
    if (!repl.rli.closed) repl.outputStream.write('\n');});

  addMultilineHandler(repl);

  if (opts.historyFile) {
    addHistory(repl, opts.historyFile, opts.historyMaxInputSize);}

  // Adapt help inherited from the node REPL

has-unicode

Try to guess if your terminal supports unicode

ISC
Latest version published 9 years ago

Package Health Score

65 / 100
Full package analysis

Popular has-unicode functions