Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@poker-apprentice/hand-range-notation
Advanced tools
Convert poker hand range notation to and from poker hands
Convert poker hand range notation to and from actual poker hands.
Add @poker-apprentice/hand-range-notation
as a dependency.
yarn add @poker-apprentice/hand-range-notation
npm install @poker-apprentice/hand-range-notation --save
expandNotation
This function is used to parse a string representing a hand range notation. If a hand range notation cannot be parsed, it will throw an InvalidHandRangeNotationError
.
// specific suited hands
const hands = expandNotation('AKs');
console.log(hands); // [['As', 'Ks'], ['Ah', 'Kh'], ['Ad', 'Kd'], ['Ac', 'Kc']]
// specific unsuited hands
const hands = expandNotation('AKo');
console.log(hands); // [['As', 'Kh'], ['As', 'Kd'], ['As', 'Kc'], /* ... */]
// specific hands regardless of suitedness
const hands = expandNotation('AK');
console.log(hands); // [['As', 'Ks'], ['As', 'Kh'], ['As', 'Kd'], /* ... */]
// specific hands with specific suits
const hands = expandNotation('AcKd');
console.log(hands); // [['Ac', 'Kd']]
// pocket pairs
const hands = expandNotation('TT');
console.log(hands); // [['Ts', 'Th'], ['Ts', 'Td'], ['Ts', 'Tc'], /* ... */]
// hand ranges
const hands = expandNotation('AKs-A2s');
const hands = expandNotation('KQo-KJo');
const hands = expandNotation('AK-AT');
const hands = expandNotation('99-22');
// hand minimums
const hands = expandNotation('AT+');
const hands = expandNotation('ATs+');
const hands = expandNotation('TT+');
// multiple ranges
const hands = expandNotation('ATs+, 99-22, AA, KQ, KJs, AcTd');
notate
This function is used to generate a hand range notation string representing a collection of hands.
Only two-card Texas Hold'em hands are supported. Providing hands of any other length will result in an InvalidHandError
being thrown.
const notation = notate([
['As', 'Ks'],
['Ah', 'Kh'],
['Ad', 'Kd'],
['Ac', 'Kc'],
['As', 'Qs'],
['Ah', 'Qh'],
['Ad', 'Qd'],
['Ac', 'Qc'],
['Js', 'Jh'],
['Js', 'Jd'],
['Js', 'Jc'],
['Jh', 'Jd'],
['Jh', 'Jc'],
['Jd', 'Jc'],
['Ts', 'Th'],
['Ts', 'Td'],
['Ts', 'Tc'],
['Th', 'Td'],
['Th', 'Tc'],
['Td', 'Tc'],
]);
console.log(notation); // 'JJ-TT,AQs+'
normalizeNotation
This function converts the provided notation into a predictable/deterministic format.
const notation = normalizeNotation('AKs,TT,QAo,AA'));
console.log(notation); // 'AA,TT,AKs,AQo'
const hands = expandNotation('7d2c,3h2s,KQo,AQo,AKo,ATs+,TT+,A2s-A5s');
const notation = notate(hands);
console.log(notation); // 'TT+,ATs+,A5s-A2s,AQo+,KQo,7d2c,3h2s'
FAQs
Convert poker hand range notation to and from poker hands
We found that @poker-apprentice/hand-range-notation demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.