Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/pdetail
Companion package to prange which provides more detail for each combo in a card range.
https://github.com/thlorenz/pdetail
Last synced: 26 days ago
JSON representation
Companion package to prange which provides more detail for each combo in a card range.
- Host: GitHub
- URL: https://github.com/thlorenz/pdetail
- Owner: thlorenz
- License: mit
- Created: 2017-06-15T03:29:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-07T17:14:37.000Z (about 7 years ago)
- Last Synced: 2024-10-23T06:15:44.906Z (2 months ago)
- Language: JavaScript
- Homepage: https://thlorenz.github.io/pdetail
- Size: 1.13 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pdetail [![build status](https://secure.travis-ci.org/thlorenz/pdetail.png)](http://travis-ci.org/thlorenz/pdetail)
Companion package to [prange](https://github.com/thlorenz/prange) which provides more detail for each combo in a card range.
```js
const { detailRange } = require('pdetail')
console.log(detailRange('AKs'))
// => Set { 'AhKh', 'AsKs', 'AdKd', 'AcKc' }
```## Installation
npm install pdetail
## [API](https://thlorenz.github.io/pdetail)
### detailRangeAll
Returns all possible 1326 combinations of cards one might hold.
Returns **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)** set of all possible card combos
### detailRangeIn
Provides all combos of the card range that are found in the provided set.
**Parameters**
- `set` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)** to be queried for the combos that are represented by the range
- `cards` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the cards for which to give a detailed combo range, i.e. 'AKs'Returns **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)** all combos that are represented by the given range and also found in the set
### detailRange
Provides all possible combinations of a given part of a card range.
'99' => '9h9s', '9h9d', '9h9c', '9s9d', '9s9c', '9d9c'
'AKs' => 'AhKh', 'AsKs', 'AdKd', 'AcKc'
'KQo' => 'KhQs', 'KhQd', 'KhQc', 'KsQh', 'KsQd', 'KsQc',
'KdQh', 'KdQs', 'KdQc', 'KcQh', 'KcQs', 'KcQd''JT' => 'JhTh', 'JhTs', 'JhTd', 'JhTc', 'JsTh', 'JsTs', 'JsTd', 'JsTc',
'JdTh', 'JdTs', 'JdTd', 'JdTc', 'JcTh', 'JcTs', 'JcTd', 'JcTc'**Parameters**
- `cards` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the cards for which to give a detailed combo range, i.e. 'AKs'
Note: that AKs is considered the same as KAs and no duplicate combos will be includedReturns **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)** set of all possible combinations on how to hold the combo
### rangeFromDetail
Calculates a range from the detail combos, i.e. obtained via `detailRange`.
Returns **any** object with the following props:- {Map} pairs: all pairs found grouped, i.e. `AA: { AdAs, AdAc ... }`
- {Map} suiteds: all suiteds found grouped, i.e. `AKs: { AdKd, AcKc ... }`
- {Map} offsuits: all offsuits found grouped, i.e. `AKo: { AdKc, AcKs ... }`
- {Set} incomplete: all incomplete ranges, i.e. `AA` if one possible AA combo was missing
- {Set} complete: all complete ranges, i.e. `AA` if none possible AA combo was missing
- {Set} all: union of incomplete and complete## License
MIT