Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

斗地主工具包

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

ddz

斗地主工具包,功能正在陆续开发中

安装

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

文档

  • card(point[, suit])
  • cards()
  • length(type)
  • point(card)
  • surface(point)
  • suit(card)
  • version()

card(point[, suit])

创建一张牌

ddz.card('K', 3) // 0xB3
ddz.card(3, 4) // 0x14

cards()

获取一副新牌,从小到大,黑红梅方

ddz.cards() // [17, 18, 19, 20, 33, 34, 35, 36, 49, 50, 51, 52, 65, 66, 67, 68, 81, 82, 83, 84, 97, 98, 99, 100, 113, 114, 115, 116, 129, 130, 131, 132, 145, 146, 147, 148, 161, 162, 163, 164, 177, 178, 179, 180, 193, 194, 195, 196, 209, 210, 211, 212, 224, 240]

length(type)

获取指定牌型的长度

ddz.length('炸弹') // 4
ddz.length('七张顺子') // 7
ddz.length('三连飞机带三对') // 15

point(card)

获取指定牌的点数

ddz.point(0x62) // 6
ddz.point(0xD1) // 13
ddz.point('K') // 11

surface(point)

获取指定点数的牌面

ddz.surface(10) // 'Q'
ddz.surface(12) // 'A'
ddz.surface(ddz.point(0x91)) // 'J'

suit(card)

获取指定牌的花色

ddz.suit(0x91) // 1
ddz.suit(0xD4) // 4
ddz.suit(0xE0) // 0

version()

  • returns: <string> 版本号。格式 x.y.z

获取当前库版本号

ddz.version() // '0.1.0'

释义

单词名词范围解释
point点数1 ~ 15牌的大小,用于判断
card牌值0x11 ~ 0xF0牌的数值形式,用于排序
surface牌面34567890JQKA2XD牌的文字表示,用于展示
suit花色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