ns

nodejs-scanf

scanf for node.js πŸ‘½

Showing:

Popularity

Downloads/wk

13

GitHub Stars

3

Maintenance

Last Commit

5yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

nodejs-scanf Build Status npm

scanf for node.js πŸ‘½

Install

npm i nodejs-scanf

Example

  • scanf

    read stdin async.

    params: format, handler

    format:

    %s string
    %d integer
    %f float
    %c character
    
    let {scanf} = require('nodejs-scanf');
    
    // input: 'hello world'
    scanf('%s', function(str) {
      console.log(str);  // output: //hello
    });
    
    // input: 'hello 2017'
    scanf('%s %d', function(str, integer) {
      console.log(str, integer); // output: //hello 2017
    });
    
    // input: '2017-04-06'
    scanf('%d-%d-%d', function(year, month, day) {
                            
    })
    
  • scanfSync

    read stdin sync

    params: format

    return a array

    let {scanfSync} = require(nodejs-scanf);
    
    let [year, month, day] = scanfSync('%d-%d-%d');
    
    let [welcome, year] = scanfSync('%s,%d');
    // input welcome,2017
    //welcome: 'welcome'
    // year: 2017
    
  • sscanf

    read input string

    params: input, format, handler

    sscanf('2017-4-06', '%d-%d-%d', function(year, month, day) {
      
    })
    

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100