ooh-node
Ooooooooooh nooooooooode!
Last updated 2 years ago by zce .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ooh-node 
SYNC missed versions from official npm registry.

ooh-node

Ooh node~

No callback in node

Console Patchs

  • console.read()
  • console.readline()
  • console.write()
  • console.writeline()
  • console.clear()
  • console.colors

Requirement

node >=7.6.0

Installation

$ yarn global add ooh-node
# or npm
$ npm i ooh-node -g

Usage

// example.js
module.exports = async function (args) {
  while (true) {
    console.clear()
    console.write(console.colors.gray('Input your age: '))

    const res = await console.readline()
    console.log(res)

    if (res === 'q' || res === 'quit' || res === 'exit') {
      console.writeline(console.colors.green('Bye bye!'))
      break
    }

    const age = parseInt(res)
    if (age) {
      if (age < 18) {
        console.writeline(console.colors.blue('You are just too young!'))
      } else {
        console.writeline(console.colors.bgYellow('Ooooooooook!'))
      }
    } else {
      console.writeline(console.colors.red('Input is invalidated.'))
    }
    console.write(console.colors.gray('Press any key to continue.'))

    await console.read()
  }
}

$ ooh-node example.js

Current Tags

  • 0.1.4                                ...           latest (2 years ago)

5 Versions

  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (2)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |