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

deckofcardsapi-client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deckofcardsapi-client

DeckOfCards API wrapper for NodeJS

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

deckofcardsapi-client

Promise-based NodeJS Client for https://deckofcardsapi.com. Supporting default instance (https://deckofcardsapi.com) or a custom one.

Usage

Here is a basic exemple, for more detailed informations, see wiki.

const  DeckBuilder  =  require("deckofcardsapi-client");

try {

	//Create a new shuffled deck of 52 cards
	const  deck  =  await  new  DeckBuilder().standardDeck();
	
	//Draw 5 cards from deck
	const hand = await deck.draw(5);	

	//Shuffle or reshuffle the deck
	await deck.shuffle();

	//Create a new pile nammed "discard"
	const discardPile = await deck.getPile("discard");

	//Add hand to discard pile
	await discardPile.add(hand);

	//List pile content
	console.log(await discardPile.list());
	

} catch (error) {

	console.log(error);

}

Using custom instance

In order to use your custom instance, include this code.

const api = require("deckofcardsapi-client").api;
api.sethost("https://exemple.com");

Keywords

FAQs

Package last updated on 24 May 2019

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