Socket
Socket
Sign inDemoInstall

ddz

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddz

斗地主工具包


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ddz

License MIT Build Status Coverage Status NPM Version

斗地主工具包,正在开发中

安装

  • 本地
npm i ddz -S
import ddz from 'ddz'
  • CDN
<script src="//unpkg.com/ddz"></script>

文档

card(point[, suit])

创建一张牌

cards()

创建一副新牌,从小到大,黑红梅方,一共 54 张

length(type)

获取指定牌型的长度

point(card)

获取指定牌的点数

shuffle(cards[, mode])

  • cards <Array<number>> 牌值数组
  • mode <string> 模式。默认 standard 使用 lodash/shuffle
  • returns: <Array<number>> 打乱过的牌值数组

洗牌,目前暂时只有标准模式,后期增加炸弹模式等

sort(cards[, desc])

排序,支持升序和降序

suit(card)

获取指定牌的花色

surface(point)

获取指定点数的牌面

version()

获取当前库版本号

ddz.version() // 'x.y.z'

说明

名词范围解释
点数1 ~ 15用于判断牌的大小
牌值0x11 ~ 0xF0牌的数值形式,用于排序
牌面34567890JQKA2XD牌的文字表示,用于展示
花色0 ~ 5王牌和黑红梅方花色,用于展示或排序

FAQs

Package last updated on 23 Dec 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc