node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

unicode-playing-card-converter

unicode-playing-card-converter

npm version Build Status Dependency Status devDependency Status

Convert playing card notation to an unicode character, and vice versa (coming soon).

Supported: Node.js 4+

const converter = require('unicode-playing-card-converter');
 
// Get U+1F0A1 PLAYING CARD ACE OF SPADES 
converter('As'); //=> '🂡' 
 
// Get U+1F0DD PLAYING CARD QUEEN OF CLUBS 
converter('Qc'); //=> '🃝' 
 
// Get U+1F0CF PLAYING CARD BLACK JOKER 
converter('X'); //=> '🃏' 
 
// Get U+1F0C9 PLAYING CARD NINE OF DIAMONDS 
converter({
    type: 'card',
    suit: 'diamond',
    rank: 9,
}); //=> '🃉' 
 
// Get U+1F0BF PLAYING CARD RED JOKER 
converter({
    type: 'special',
    kind: 'joker',
    variation: 2,
}); //=> '🂿' 
 
// Get U+1F0A0 PLAYING CARD BACK 
converter({
    type: 'special',
    kind: 'back',
    variation: 0,
}); //=> '🂠'