52-deck 中文文档教程

发布于 8年前 浏览 29 项目主页 更新于 3年前

52-deck

构建: “依赖状态”devDependency Status

Installation (2.46 kB)

  • yarn add 52-deck
  • or npm install 52-deck

Usage

Get 52 cards deck

import { newDeck } from '52-deck'

const deck = newDeck()

Shuffle 2 decks

import { shuffle, newDecks } from '52-deck'

const deck = shuffle(newDecks(2))

Serialize

import { serializeCards } from '52-deck'

const [ firstCard, secondCard ] = serializeCards('♦K ♦2')

有效的输入字符串是:

  • h1 s1 d12
  • 11d 9s 9d 4s 12h 13d 13h 11h
  • ♠10 ♦1 ♥5 ♣6 ♠11 ♦10
  • 1-h 10-s
  • 12spades 8diamond

Card Model

type Card = {
  text: string,
  suite: string,
  value: number,
  color: string
}

52-deck

build:Dependency StatusdevDependency Status

Installation (2.46 kB)

  • yarn add 52-deck
  • or npm install 52-deck

Usage

Get 52 cards deck

import { newDeck } from '52-deck'

const deck = newDeck()

Shuffle 2 decks

import { shuffle, newDecks } from '52-deck'

const deck = shuffle(newDecks(2))

Serialize

import { serializeCards } from '52-deck'

const [ firstCard, secondCard ] = serializeCards('♦K ♦2')

Valid input strings are:

  • h1 s1 d12
  • 11d 9s 9d 4s 12h 13d 13h 11h
  • ♠10 ♦1 ♥5 ♣6 ♠11 ♦10
  • 1-h 10-s
  • 12spades 8diamond

Card Model

type Card = {
  text: string,
  suite: string,
  value: number,
  color: string
}
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文