Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/prange
Parses poker hand range short notation into a range array.
https://github.com/thlorenz/prange
Last synced: 15 days ago
JSON representation
Parses poker hand range short notation into a range array.
- Host: GitHub
- URL: https://github.com/thlorenz/prange
- Owner: thlorenz
- License: mit
- Created: 2017-03-05T02:44:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-01T07:08:21.000Z (almost 7 years ago)
- Last Synced: 2024-10-18T13:17:24.607Z (19 days ago)
- Language: JavaScript
- Homepage: https://thlorenz.github.io/prange
- Size: 1.13 MB
- Stars: 22
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prange [![build status](https://secure.travis-ci.org/thlorenz/prange.png)](http://travis-ci.org/thlorenz/prange)
Parses poker hand range short notation into a range array.
```js
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](https://thlorenz.github.io/prange)
### 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the short notation for the range
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** hand combos to be converted to short notation
- `the` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** short notation for the range## License
MIT