开发者社区> 镜像站> NPM> prange
prange
Parses poker hand range short descriptions into a range array.
Last updated 3 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install prange 
SYNC missed versions from official npm registry.

prange build status

Parses poker hand range short notation into a range array.

const prange = require('./')

const r1 = prange('AKs-ATs, QQ+')
const r2 = prange('JTs-54s')

console.log(r1)
// [ 'AA', 'AKs', 'AQs', 'AJs', 'ATs', 'KK', 'QQ' ]

console.log(r2)
// [ 'JTs', 'T9s', '98s', '87s', '76s', '65s', '54s' ]

console.log(prange.reverse(r1))
// QQ+, ATs+

console.log(prange.reverse(r2))
// JTs-54s

Installation

npm install prange

API

prange

Converts a short notation for poker hand ranges into an array filled with the matching combos.

Each range specifier is separated by a comma.

The following notations are supported:

  • single combos KK, AK, ATs
  • plus notation
    • QQ+ = [ AA, KK, QQ ]
    • KTs+ = [ KQs, KJs, KTs ]
    • KTo+ = [ KQo, KJo, KTo ]
    • KT+ = [ KQs, KQo, KJo, KJs, KTo, KTs ]
  • dash notation
    • KK-JJ = [ KK, QQ, JJ ]
    • AKo-ATo = [ AK, AQ, AJ, AT ]
    • AKs-JTs = [ AKs, KQs, JTs ]

Parameters

  • s String the short notation for the range

Returns Array<String> all hand combos satisfying the given range

prange.reverse

Converts a poker hand range to short notation. It's the opposite of prange.

Parameters

  • combos Array<String> hand combos to be converted to short notation
  • the String short notation for the range

License

MIT

Current Tags

  • 0.2.3                                ...           latest (3 years ago)

6 Versions

  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           4 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (0)
None