Socket
Socket
Sign inDemoInstall

@types/chance

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/chance - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

102

chance/index.d.ts

@@ -8,3 +8,8 @@ // Type definitions for Chance 1.0

// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// a bit of cleverness from jcalz at https://stackoverflow.com/a/48244432
// this will ensure that empty objects are not allowed for objects with optional parameters
type AtLeastOneKey<T, U = { [K in keyof T]: Pick<T, K> }> = Partial<T> & U[keyof U];
declare namespace Chance {

@@ -29,15 +34,15 @@ type Seed = number | string;

// Basics
bool(opts?: Options): boolean;
bool(opts?: {likelihood: number}): boolean;
character(opts?: Options): string;
floating(opts?: Options): number;
integer(opts?: Options): number;
integer(opts?: AtLeastOneKey<IntegerOptions>): number;
letter(opts?: Options): string;
natural(opts?: Options): number;
string(opts?: Options): string;
string(opts?: AtLeastOneKey<StringOptions>): string;
// Text
paragraph(opts?: Options): string;
sentence(opts?: Options): string;
sentence(opts?: AtLeastOneKey<SentenceOptions>): string;
syllable(opts?: Options): string;
word(opts?: Options): string;
word(opts?: AtLeastOneKey<WordOptions>): string;

@@ -51,10 +56,10 @@ // Person

cpf(): string;
first(opts?: Options): string;
last(opts?: Options): string;
name(opts?: Options): string;
name_prefix(opts?: Options): string;
name_suffix(opts?: Options): string;
prefix(opts?: Options): string;
first(opts?: AtLeastOneKey<FirstNameOptions>): string;
last(opts?: LastNameOptions): string;
name(opts?: AtLeastOneKey<NameOptions>): string;
name_prefix(opts?: AtLeastOneKey<PrefixOptions>): string;
name_suffix(opts?: SuffixOptions): string;
prefix(opts?: AtLeastOneKey<PrefixOptions>): string;
ssn(opts?: Options): string;
suffix(opts?: Options): string;
suffix(opts?: SuffixOptions): string;

@@ -76,3 +81,3 @@ // Mobile

domain(opts?: Options): string;
email(opts?: Options): string;
email(opts?: AtLeastOneKey<EmailOptions>): string;
fbid(): string;

@@ -87,3 +92,3 @@ google_analytics(): string;

twitter(): string;
url(opts?: Options): string;
url(opts?: AtLeastOneKey<UrlOptions>): string;

@@ -100,4 +105,4 @@ // Location

latitude(opts?: Options): number;
locale(opts?: LocaleOptions): string;
locales(opts?: LocaleOptions): string;
locale(opts?: {region: true}): string;
locales(opts?: {region: true}): string[];
longitude(opts?: Options): number;

@@ -195,2 +200,63 @@ phone(opts?: Options): string;

interface WordOptions {
length: number;
syllables: number;
capitalize: boolean;
}
interface StringOptions {
length: number;
pool: string;
}
interface UrlOptions {
protocol: string;
domain: string;
domain_prefix: string;
path: string;
extensions: string[];
}
interface IntegerOptions {
min: number;
max: number;
}
type FirstNameNationalities = 'en' | 'it';
type LastNameNationalities = FirstNameNationalities | 'nl' | 'uk' | 'de' | 'jp' | 'es' | 'fr' | '*';
interface FullNameOptions {
middle: boolean;
middle_initial: boolean;
prefix: boolean;
suffix: boolean;
}
interface FirstNameOptions {
gender: 'male' | 'female';
nationality: FirstNameNationalities;
}
interface LastNameOptions {
nationality: LastNameNationalities;
}
interface SuffixOptions {
full: boolean;
}
type PrefixOptions = { gender: 'male' | 'female' | 'all' } & SuffixOptions;
type NameOptions = FullNameOptions & FirstNameOptions & LastNameOptions & PrefixOptions;
interface EmailOptions {
length: number;
domain: string;
}
interface SentenceOptions {
words: number;
punctuation: '.' | '?' | ';' | '!' | ':' | boolean;
}
interface DateOptions {

@@ -206,6 +272,2 @@ string?: boolean;

interface LocaleOptions {
region: boolean;
}
interface Month {

@@ -212,0 +274,0 @@ name: string;

6

chance/package.json
{
"name": "@types/chance",
"version": "1.0.2",
"version": "1.0.3",
"description": "TypeScript definitions for Chance",

@@ -37,4 +37,4 @@ "license": "MIT",

"dependencies": {},
"typesPublisherContentHash": "f6d6dfbdd0e33a84357b962b2f1b0bbffe1f2f725255aac47b85bd6af54b6052",
"typeScriptVersion": "2.0"
"typesPublisherContentHash": "7a18be024e15c2c0c3093cb00545b4e2604b5769a960b8e263aa8bb2dc3e560c",
"typeScriptVersion": "2.3"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Thu, 11 Apr 2019 21:12:56 GMT
* Last updated: Mon, 13 May 2019 23:08:15 GMT
* Dependencies: none

@@ -14,0 +14,0 @@ * Global values: none

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