Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/pdetail-diff
Concise way to express which card combos found in a set are also set in another
https://github.com/thlorenz/pdetail-diff
Last synced: 13 days ago
JSON representation
Concise way to express which card combos found in a set are also set in another
- Host: GitHub
- URL: https://github.com/thlorenz/pdetail-diff
- Owner: thlorenz
- License: mit
- Created: 2017-09-28T04:09:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-30T05:05:10.000Z (over 7 years ago)
- Last Synced: 2024-12-10T08:27:36.461Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://thlorenz.github.io/pdetail-diff
- 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-diff [![build status](https://secure.travis-ci.org/thlorenz/pdetail-diff.png)](http://travis-ci.org/thlorenz/pdetail-diff)
Concise way to express which card combos found in a set are also set in another
```js
const { createDiff, applyDiff } = require('pdetail-diff')const diff = createDiff(availableSet, includedSet, blockers)
const res = applyDiff(availableSet, diff, blockers)
// => res now has exact same combos as the original includedSet
```## Installation
npm install pdetail-diff
## [API](https://thlorenz.github.io/pdetail-diff)
### createDiff
Creates a diff between the detailed combo sets that were available and the ones
of those that were included.It assumes that we can only include available combos and omits
any checks to verify in order to not hurt performance.If all details of a combo that were available were also included it adds
the combo specifier, i.e. 'AA' or 'AKs' to the `complete` set.
If some details were missing it instead adds the included combos to the
`incomplete` set, i.e. `AsKs, AhKh, AcKc`.**Note** round tripping `createDiff` and `applyDiff`, results in the original `included` set.
**Parameters**
- `available` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** detail set of combos that were available to be included
- `included` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** detail set of the available combos that were included
- `blockers` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** cards that may be part of `available` combos but are blocked
for the `included` set i.e. `'Ah', 'Ks'`Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** result `{ complete, incomplete }` `complete` being a set of combo notations for detail sets that
were fully included and `incomplete` a set of detail notations of combos that were partially included### applyDiff
Applies a diff derived via `createDiff` to the `available` set.
**Parameters**
- `available` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** detail set of combos that were available to be included
- `blockers` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** cards that weren't available to be included when diff was created, i.e. `'Ah', 'Ks'`
should be the same as the ones passed to `createDiff` to arrive at the same `included` setReturns **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)** included combos for which the diff from the available ones was created
## License
MIT