Skip to content

A small library for getting stats on punctuation in files. - Node Module

License

Notifications You must be signed in to change notification settings

gitfaf/node-punctuation-stats

Repository files navigation

node-punctuation-stats

A small library for getting stats on punctuation in files. - Node Module

Usage

  var PS = require('node-punctuation-stats')

  var p = new PS()

  p.inFile('./index.js')
  { punctuations: [ '!', '?', '.', ',', ';', ':' ],
    found:
    [ { symbol: '!', count: 1 },
      { symbol: '?', count: 1 },
      { symbol: '.', count: 17 },
      { symbol: ',', count: 12 },
      { symbol: ';', count: 1 },
      { symbol: ':', count: 8 } ],
    total: 40,
    message: 'Found 40 punctuations of 6 types: ! ? . , ; :'
  }

  const data = fs.readFileSync('./index.js').toString()
  p.inText(data)
  { punctuations: [ '!', '?', '.', ',', ';', ':' ],
    found:
    [ { symbol: '!', count: 1 },
      { symbol: '?', count: 1 },
      { symbol: '.', count: 17 },
      { symbol: ',', count: 12 },
      { symbol: ';', count: 1 },
      { symbol: ':', count: 8 } ],
    total: 40,
    message: 'Found 40 punctuations of 6 types: ! ? . , ; :'
  }

  p.inDir('./', '.js')
  [
    {
      file: 'index.js',
      found:
      {
        punctuations: [Array],
        found: [Array],
        total: 50,
        message: 'Found 50 punctuations of 6 types: ! ? . , ; :'
      }
    }
  ]

Licensce

MIT © 2018 Git Faf

About

A small library for getting stats on punctuation in files. - Node Module

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published