aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-11-13 09:20:17 +0100
committerGitHub <[email protected]>2023-11-13 08:20:17 +0000
commita747854d6b5d4db5c02ff344b8abb322c6ceac99 (patch)
treedd1b53816d9c6ba3986ed85b001dbdcd68111f4b /src
parent7ce8c285cb5b2d13e95a17be78ecbd52f3c7d9db (diff)
downloadfaker-a747854d6b5d4db5c02ff344b8abb322c6ceac99.tar.xz
faker-a747854d6b5d4db5c02ff344b8abb322c6ceac99.zip
test(docs): ensure defaults are consistent (#2177)
Diffstat (limited to 'src')
-rw-r--r--src/modules/airline/index.ts6
-rw-r--r--src/modules/commerce/index.ts28
-rw-r--r--src/modules/datatype/index.ts6
-rw-r--r--src/modules/date/index.ts2
-rw-r--r--src/modules/finance/index.ts38
-rw-r--r--src/modules/helpers/index.ts16
-rw-r--r--src/modules/internet/index.ts36
-rw-r--r--src/modules/location/index.ts72
-rw-r--r--src/modules/number/index.ts12
-rw-r--r--src/modules/person/index.ts2
-rw-r--r--src/modules/random/index.ts6
-rw-r--r--src/modules/string/index.ts20
-rw-r--r--src/modules/system/index.ts2
13 files changed, 156 insertions, 90 deletions
diff --git a/src/modules/airline/index.ts b/src/modules/airline/index.ts
index f0ada30c..4c1ec318 100644
--- a/src/modules/airline/index.ts
+++ b/src/modules/airline/index.ts
@@ -125,7 +125,7 @@ export class AirlineModule extends ModuleBase {
* are used by airlines to identify reservations. They're also known as booking reference numbers,
* locator codes, confirmation codes, or reservation codes.
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.allowNumerics Whether to allow numeric characters. Defaults to `false`.
* @param options.allowVisuallySimilarCharacters Whether to allow visually similar characters such as '1' and 'I'. Defaults to `false`.
*
@@ -174,7 +174,7 @@ export class AirlineModule extends ModuleBase {
/**
* Generates a random seat.
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.aircraftType The aircraft type. Can be one of `narrowbody`, `regional`, `widebody`. Defaults to `narrowbody`.
*
* @example
@@ -225,7 +225,7 @@ export class AirlineModule extends ModuleBase {
* `${faker.airline.airline().iataCode}${faker.airline.flightNumber({ addLeadingZeros: true })}` // 'AA0798'
* ```
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.length The number or range of digits to generate. Defaults to `{ min: 1, max: 4 }`.
* @param options.addLeadingZeros Whether to pad the flight number up to 4 digits with leading zeros. Defaults to `false`.
*
diff --git a/src/modules/commerce/index.ts b/src/modules/commerce/index.ts
index 48f56568..1be3fcb2 100644
--- a/src/modules/commerce/index.ts
+++ b/src/modules/commerce/index.ts
@@ -115,7 +115,7 @@ export class CommerceModule extends ModuleBase {
/**
* Generates a price between min and max (inclusive).
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.min The minimum price. Defaults to `1`.
* @param options.max The maximum price. Defaults to `1000`.
* @param options.dec The number of decimal places. Defaults to `2`.
@@ -179,7 +179,7 @@ export class CommerceModule extends ModuleBase {
/**
* Generates a price between min and max (inclusive).
*
- * @param options The minimum price or on options object. Defaults to `{}`.
+ * @param options The minimum price or on options object.
* @param options.min The minimum price. Defaults to `1`.
* @param options.max The maximum price. Defaults to `1000`.
* @param options.dec The number of decimal places. Defaults to `2`.
@@ -201,9 +201,29 @@ export class CommerceModule extends ModuleBase {
options?:
| number
| {
+ /**
+ * The minimum price.
+ *
+ * @default 1
+ */
min?: number;
+ /**
+ * The maximum price.
+ *
+ * @default 1000
+ */
max?: number;
+ /**
+ * The number of decimal places.
+ *
+ * @default 2
+ */
dec?: number;
+ /**
+ * The currency value to use.
+ *
+ * @default ''
+ */
symbol?: string;
},
legacyMax?: number,
@@ -213,7 +233,7 @@ export class CommerceModule extends ModuleBase {
/**
* Generates a price between min and max (inclusive).
*
- * @param options The minimum price or on options object. Defaults to `{}`.
+ * @param options The minimum price or on options object.
* @param options.min The minimum price. Defaults to `1`.
* @param options.max The maximum price. Defaults to `1000`.
* @param options.dec The number of decimal places. Defaults to `2`.
@@ -330,7 +350,7 @@ export class CommerceModule extends ModuleBase {
/**
* Returns a random [ISBN](https://en.wikipedia.org/wiki/ISBN) identifier.
*
- * @param options The variant to return or an options object. Defaults to `{}`.
+ * @param options The variant to return or an options object.
* @param options.variant The variant to return. Can be either `10` (10-digit format)
* or `13` (13-digit format). Defaults to `13`.
* @param options.separator The separator to use in the format. Defaults to `'-'`.
diff --git a/src/modules/datatype/index.ts b/src/modules/datatype/index.ts
index a8b77a2c..ad0b5489 100644
--- a/src/modules/datatype/index.ts
+++ b/src/modules/datatype/index.ts
@@ -15,7 +15,7 @@ export class DatatypeModule extends SimpleModuleBase {
* Returns a single random number between zero and the given max value or the given range with the specified precision.
* The bounds are inclusive.
*
- * @param options Maximum value or options object.
+ * @param options Maximum value or options object. Defaults to `99999`.
* @param options.min Lower bound for generated number. Defaults to `0`.
* @param options.max Upper bound for generated number. Defaults to `min + 99999`.
* @param options.precision Precision of the generated number. Defaults to `1`.
@@ -213,7 +213,7 @@ export class DatatypeModule extends SimpleModuleBase {
/**
* Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
*
- * @param options Length of the generated string or an options object. Defaults to `{}`.
+ * @param options Length of the generated string or an options object.
* @param options.length Length of the generated string. Max length is `2^20`. Defaults to `10`.
*
* @see faker.string.sample()
@@ -285,7 +285,7 @@ export class DatatypeModule extends SimpleModuleBase {
* If the probability is `>= 1.0`, it will always return `true`.
* The probability is limited to two decimal places.
*
- * @param options The optional options object or the probability (`[0.00, 1.00]`) of returning `true`. Defaults to `0.5`.
+ * @param options The optional options object or the probability (`[0.00, 1.00]`) of returning `true`.
* @param options.probability The probability (`[0.00, 1.00]`) of returning `true`. Defaults to `0.5`.
*
* @example
diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts
index d79da51f..a40b4772 100644
--- a/src/modules/date/index.ts
+++ b/src/modules/date/index.ts
@@ -491,7 +491,7 @@ export class SimpleDateModule extends SimpleModuleBase {
* @param options.to The late date boundary.
* @param options.count The number of dates to generate. Defaults to `3`.
* @param legacyTo Deprecated, use `options.to` instead.
- * @param legacyCount Deprecated, use `options.count` instead.
+ * @param legacyCount Deprecated, use `options.count` instead. Defaults to `3`.
*
* @example
* faker.date.betweens({ from: '2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z' })
diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts
index 4e0d80ed..c443b605 100644
--- a/src/modules/finance/index.ts
+++ b/src/modules/finance/index.ts
@@ -78,7 +78,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random account number.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.length The length of the account number. Defaults to `8`.
*
* @example
@@ -98,7 +98,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random account number.
*
- * @param optionsOrLength An options object or the length of the account number. Defaults to `{}`.
+ * @param optionsOrLength An options object or the length of the account number.
* @param optionsOrLength.length The length of the account number. Defaults to `8`.
*
* @example
@@ -123,7 +123,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random account number.
*
- * @param options An options object or the length of the account number. Defaults to `{}`.
+ * @param options An options object or the length of the account number.
* @param options.length The length of the account number. Defaults to `8`.
*
* @example
@@ -241,7 +241,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random masked number.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.length The length of the unmasked number. Defaults to `4`.
* @param options.parens Whether to use surrounding parenthesis. Defaults to `true`.
* @param options.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`.
@@ -262,7 +262,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random masked number.
*
- * @param optionsOrLength An options object or the length of the unmask number. Defaults to `{}`.
+ * @param optionsOrLength An options object or the length of the unmask number.
* @param optionsOrLength.length The length of the unmasked number. Defaults to `4`.
* @param optionsOrLength.parens Whether to use surrounding parenthesis. Defaults to `true`.
* @param optionsOrLength.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`.
@@ -303,7 +303,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random masked number.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.length The length of the unmasked number. Defaults to `4`.
* @param options.parens Whether to use surrounding parenthesis. Defaults to `true`.
* @param options.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`.
@@ -388,7 +388,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random amount between the given bounds (inclusive).
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.min The lower bound for the amount. Defaults to `0`.
* @param options.max The upper bound for the amount. Defaults to `1000`.
* @param options.dec The number of decimal places for the amount. Defaults to `2`.
@@ -439,7 +439,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random amount between the given bounds (inclusive).
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.min The lower bound for the amount. Defaults to `0`.
* @param options.max The upper bound for the amount. Defaults to `1000`.
* @param options.dec The number of decimal places for the amount. Defaults to `2`.
@@ -448,7 +448,7 @@ export class FinanceModule extends ModuleBase {
* @param legacyMax The upper bound for the amount. Defaults to `1000`.
* @param legacyDec The number of decimal places for the amount. Defaults to `2`.
* @param legacySymbol The symbol used to prefix the amount. Defaults to `''`.
- * @param legacyAutoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`.
+ * @param legacyAutoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`. Defaults to `false`.
*
* @example
* faker.finance.amount() // '617.87'
@@ -506,7 +506,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random amount between the given bounds (inclusive).
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.min The lower bound for the amount. Defaults to `0`.
* @param options.max The upper bound for the amount. Defaults to `1000`.
* @param options.dec The number of decimal places for the amount. Defaults to `2`.
@@ -515,7 +515,7 @@ export class FinanceModule extends ModuleBase {
* @param legacyMax The upper bound for the amount. Defaults to `1000`.
* @param legacyDec The number of decimal places for the amount. Defaults to `2`.
* @param legacySymbol The symbol used to prefix the amount. Defaults to `''`.
- * @param legacyAutoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`.
+ * @param legacyAutoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`. Defaults to `false`.
*
* @example
* faker.finance.amount() // '617.87'
@@ -750,7 +750,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random credit card number.
*
- * @param options An options object, the issuer or a custom format. Defaults to `{}`.
+ * @param options An options object, the issuer or a custom format.
* @param options.issuer The name of the issuer (case-insensitive) or the format used to generate one.
*
* @example
@@ -776,7 +776,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random credit card number.
*
- * @param options An options object, the issuer or a custom format. Defaults to `{}`.
+ * @param options An options object, the issuer or a custom format.
* @param options.issuer The name of the issuer (case-insensitive) or the format used to generate one.
*
* @example
@@ -867,7 +867,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random PIN number.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.length The length of the PIN to generate. Defaults to `4`.
*
* @throws Will throw an error if length is less than 1.
@@ -889,7 +889,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random PIN number.
*
- * @param options An options object or the length of the PIN. Defaults to `{}`.
+ * @param options An options object or the length of the PIN.
* @param options.length The length of the PIN to generate. Defaults to `4`.
*
* @throws Will throw an error if length is less than 1.
@@ -916,7 +916,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random PIN number.
*
- * @param options An options object or the length of the PIN. Defaults to `{}`.
+ * @param options An options object or the length of the PIN.
* @param options.length The length of the PIN to generate. Defaults to `4`.
*
* @throws Will throw an error if length is less than 1.
@@ -990,7 +990,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random iban.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
*
@@ -1019,7 +1019,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random iban.
*
- * @param options An options object or whether the return value should be formatted. Defaults to `{}`.
+ * @param options An options object or whether the return value should be formatted.
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
* @param legacyCountryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
@@ -1056,7 +1056,7 @@ export class FinanceModule extends ModuleBase {
/**
* Generates a random iban.
*
- * @param options An options object or whether the return value should be formatted. Defaults to `{}`.
+ * @param options An options object or whether the return value should be formatted.
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
* @param legacyCountryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index f7d9538b..59eeadba 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -175,7 +175,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* For that all spaces (` `) are replaced by hyphens (`-`)
* and most non word characters except for dots and hyphens will be removed.
*
- * @param string The input to slugify.
+ * @param string The input to slugify. Defaults to `''`.
*
* @example
* faker.helpers.slugify() // ''
@@ -195,7 +195,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* Parses the given string symbol by symbol and replaces the placeholders with digits (`0` - `9`).
* `!` will be replaced by digits >=2 (`2` - `9`).
*
- * @param string The template string to parse.
+ * @param string The template string to parse. Defaults to `''`.
* @param symbol The symbol to replace with digits. Defaults to `'#'`.
*
* @example
@@ -228,7 +228,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* - `?` will be replaced with an upper letter ('A' - 'Z')
* - and `*` will be replaced with either a digit or letter.
*
- * @param string The template string to parse.
+ * @param string The template string to parse. Defaults to `''`.
*
* @example
* faker.helpers.replaceSymbols() // ''
@@ -293,8 +293,8 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* This method supports both range patterns `[4-9]` as well as the patterns used by `replaceSymbolWithNumber()`.
* `L` will be replaced with the appropriate Luhn checksum.
*
- * @param string The credit card format pattern. Defaults to `6453-####-####-####-###L`.
- * @param symbol The symbol to replace with a digit.
+ * @param string The credit card format pattern. Defaults to `'6453-####-####-####-###L'`.
+ * @param symbol The symbol to replace with a digit. Defaults to `'#'`.
*
* @example
* faker.helpers.replaceCreditCardSymbols() // '6453-4876-8626-8995-3771'
@@ -323,7 +323,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* - `.{min,max}` => Repeat the character `min` to `max` times.
* - `[min-max]` => Generate a number between min and max (inclusive).
*
- * @param string The template string to parse.
+ * @param string The template string to parse. Defaults to `''`.
*
* @see faker.helpers.fromRegExp()
*
@@ -769,7 +769,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* @template TResult The type of result of the given callback.
*
* @param callback The callback to that will be invoked if the probability check was successful.
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.probability The probability (`[0.00, 1.00]`) of the callback being invoked. Defaults to `0.5`.
*
* @example
@@ -1092,7 +1092,7 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* @template TMethod The type of the method to execute.
*
* @param method The method used to generate the values.
- * @param args The arguments used to call the method.
+ * @param args The arguments used to call the method. Defaults to `[]`.
* @param options The optional options used to configure this method.
* @param options.startTime This parameter does nothing.
* @param options.maxTime The time in milliseconds this method may take before throwing an error. Defaults to `50`.
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index 4f58615f..5eb9b4bc 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -56,7 +56,7 @@ export class InternetModule extends ModuleBase {
/**
* Generates an email address using the given person's name as base.
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
* @param options.provider The mail provider domain to use. If not specified, a random free mail provider will be chosen.
@@ -101,7 +101,7 @@ export class InternetModule extends ModuleBase {
* @param firstName The optional first name to use. If not specified, a random one will be chosen.
* @param lastName The optional last name to use. If not specified, a random one will be chosen.
* @param provider The mail provider domain to use. If not specified, a random free mail provider will be chosen.
- * @param options The options to use. Defaults to `{ allowSpecialCharacters: false }`.
+ * @param options The options to use.
* @param options.allowSpecialCharacters Whether special characters such as ``.!#$%&'*+-/=?^_`{|}~`` should be included
* in the email address. Defaults to `false`.
*
@@ -131,7 +131,7 @@ export class InternetModule extends ModuleBase {
/**
* Generates an email address using the given person's name as base.
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
* @param options.provider The mail provider domain to use. If not specified, a random free mail provider will be chosen.
@@ -139,7 +139,7 @@ export class InternetModule extends ModuleBase {
* in the email address. Defaults to `false`.
* @param legacyLastName The optional last name to use. If not specified, a random one will be chosen.
* @param legacyProvider The mail provider domain to use. If not specified, a random free mail provider will be chosen.
- * @param legacyOptions The options to use. Defaults to `{ allowSpecialCharacters: false }`.
+ * @param legacyOptions The options to use.
* @param legacyOptions.allowSpecialCharacters Whether special characters such as ``.!#$%&'*+-/=?^_`{|}~`` should be included
* in the email address. Defaults to `false`.
*
@@ -287,7 +287,7 @@ export class InternetModule extends ModuleBase {
/**
* Generates an email address using an example mail provider using the given person's name as base.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
* @param options.allowSpecialCharacters Whether special characters such as ``.!#$%&'*+-/=?^_`{|}~`` should be included
@@ -325,7 +325,7 @@ export class InternetModule extends ModuleBase {
*
* @param firstName The optional first name to use. If not specified, a random one will be chosen.
* @param lastName The optional last name to use. If not specified, a random one will be chosen.
- * @param options The options to use. Defaults to `{ allowSpecialCharacters: false }`.
+ * @param options The options to use.
* @param options.allowSpecialCharacters Whether special characters such as ``.!#$%&'*+-/=?^_`{|}~`` should be included
* in the email address. Defaults to `false`.
*
@@ -353,13 +353,13 @@ export class InternetModule extends ModuleBase {
/**
* Generates an email address using an example mail provider using the given person's name as base.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
* @param options.allowSpecialCharacters Whether special characters such as ``.!#$%&'*+-/=?^_`{|}~`` should be included
* in the email address. Defaults to `false`.
* @param legacyLastName The optional last name to use. If not specified, a random one will be chosen.
- * @param legacyOptions The options to use. Defaults to `{}`.
+ * @param legacyOptions The options to use.
* @param legacyOptions.allowSpecialCharacters Whether special characters such as ``.!#$%&'*+-/=?^_`{|}~`` should be included
* in the email address. Defaults to `false`.
*
@@ -477,7 +477,7 @@ export class InternetModule extends ModuleBase {
* This will always return a plain ASCII string.
* Some basic stripping of accents and transliteration of characters will be done.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
*
@@ -537,7 +537,7 @@ export class InternetModule extends ModuleBase {
* This will always return a plain ASCII string.
* Some basic stripping of accents and transliteration of characters will be done.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
* @param legacyLastName The optional last name to use. If not specified, a random one will be chosen.
@@ -661,7 +661,7 @@ export class InternetModule extends ModuleBase {
* If the input names include Unicode characters, the resulting display name will contain Unicode characters.
* It will not contain spaces.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
*
@@ -721,7 +721,7 @@ export class InternetModule extends ModuleBase {
* If the input names include Unicode characters, the resulting display name will contain Unicode characters.
* It will not contain spaces.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
* @param legacyLastName The optional last name to use. If not specified, a random one will be chosen.
@@ -1043,7 +1043,7 @@ export class InternetModule extends ModuleBase {
* Based on
* http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.redBase The optional base red in range between `0` and `255`. Defaults to `0`.
* @param options.greenBase The optional base green in range between `0` and `255`. Defaults to `0`.
* @param options.blueBase The optional base blue in range between `0` and `255`. Defaults to `0`.
@@ -1099,7 +1099,7 @@ export class InternetModule extends ModuleBase {
* Based on
* http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.redBase The optional base red in range between `0` and `255`. Defaults to `0`.
* @param options.greenBase The optional base green in range between `0` and `255`. Defaults to `0`.
* @param options.blueBase The optional base blue in range between `0` and `255`. Defaults to `0`.
@@ -1202,7 +1202,7 @@ export class InternetModule extends ModuleBase {
/**
* Generates a random mac address.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param separator The optional separator to use. Can be either `':'`, `'-'` or `''`. Defaults to `':'`.
*
* @example
@@ -1232,7 +1232,7 @@ export class InternetModule extends ModuleBase {
/**
* Generates a random mac address.
*
- * @param options The optional separator or an options object. Defaults to `{}`.
+ * @param options The optional separator or an options object.
* @param separator The optional separator to use. Can be either `':'`, `'-'` or `''`. Defaults to `':'`.
*
* @example
@@ -1292,7 +1292,7 @@ export class InternetModule extends ModuleBase {
* Generates a random password-like string. Do not use this method for generating actual passwords for users.
* Since the source of the randomness is not cryptographically secure, neither is this generator.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.length The length of the password to generate. Defaults to `15`.
* @param options.memorable Whether the generated password should be memorable. Defaults to `false`.
* @param options.pattern The pattern that all chars should match.
@@ -1364,7 +1364,7 @@ export class InternetModule extends ModuleBase {
/**
* Generates a random password.
*
- * @param options The length of the password or an options object. Defaults to `{}`.
+ * @param options The length of the password or an options object.
* @param options.length The length of the password to generate. Defaults to `15`.
* @param options.memorable Whether the generated password should be memorable. Defaults to `false`.
* @param options.pattern The pattern that all chars should match.
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts
index baf51c51..1c20d713 100644
--- a/src/modules/location/index.ts
+++ b/src/modules/location/index.ts
@@ -18,7 +18,7 @@ export class LocationModule extends ModuleBase {
* Generates random zip code from specified format. If format is not specified,
* the locale's zip format is used.
*
- * @param options The format used to generate the zip code or an options object. Defaults to `{}`.
+ * @param options The format used to generate the zip code or an options object.
* @param options.state The state to generate the zip code for.
* If the current locale does not have a corresponding `postcode_by_state` definition, an error is thrown.
* @param options.format The optional format used to generate the zip code.
@@ -85,7 +85,7 @@ export class LocationModule extends ModuleBase {
*
* If the current locale does not have a corresponding `postcode_by_state` definition, an error is thrown.
*
- * @param options A state abbreviation or an options object. Defaults to `{}`.
+ * @param options A state abbreviation or an options object.
* @param options.state The abbreviation of the state to generate the zip code for.
* If not specified, a random zip code is generated according to the locale's zip format.
*
@@ -227,7 +227,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random localized street address.
*
- * @param options Whether to use a full address or an options object. Defaults to `{}`.
+ * @param options Whether to use a full address or an options object.
* @param options.useFullAddress When true this will generate a full address.
* Otherwise it will just generate a street address.
*
@@ -314,7 +314,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code.
*
- * @param options The code to return or an options object. Defaults to `{}`.
+ * @param options The code to return or an options object.
* @param options.variant The variant to return. Can be one of:
*
* - `'alpha-2'` (two-letter code)
@@ -373,7 +373,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.abbreviated If true this will return abbreviated first-level administrative entity names.
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -427,7 +427,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random latitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the latitude to generate. Defaults to `90`.
* @param options.min The lower bound for the latitude to generate. Defaults to `-90`.
* @param options.precision The number of decimal points of precision for the latitude. Defaults to `4`.
@@ -479,7 +479,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random latitude.
*
- * @param options The upper bound for the latitude or an options object. Defaults to `{}`.
+ * @param options The upper bound for the latitude or an options object.
* @param options.max The upper bound for the latitude to generate. Defaults to `90`.
* @param options.min The lower bound for the latitude to generate. Defaults to `-90`.
* @param options.precision The number of decimal points of precision for the latitude. Defaults to `4`.
@@ -526,7 +526,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random latitude.
*
- * @param options The upper bound for the latitude or an options object. Defaults to `{}`.
+ * @param options The upper bound for the latitude or an options object.
* @param options.max The upper bound for the latitude to generate. Defaults to `90`.
* @param options.min The lower bound for the latitude to generate. Defaults to `-90`.
* @param options.precision The number of decimal points of precision for the latitude. Defaults to `4`.
@@ -582,7 +582,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -618,7 +618,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -635,7 +635,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options The upper bound for the longitude or an options object. Defaults to `{}`.
+ * @param options The upper bound for the longitude or an options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -679,7 +679,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -735,7 +735,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random direction (cardinal and ordinal; northwest, east, etc).
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.abbreviated If true this will return abbreviated directions (NW, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -773,7 +773,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random direction (cardinal and ordinal; northwest, east, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -799,7 +799,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random direction (cardinal and ordinal; northwest, east, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -848,7 +848,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random cardinal direction (north, east, south, west).
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.abbreviated If true this will return abbreviated directions (N, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -912,7 +912,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random cardinal direction (north, east, south, west).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (N, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -960,7 +960,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -982,7 +982,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -999,7 +999,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -1025,7 +1025,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -1087,8 +1087,21 @@ export class LocationModule extends ModuleBase {
* @since 8.0.0
*/
nearbyGPSCoordinate(options?: {
+ /**
+ * The original coordinate to get a new coordinate close to.
+ */
origin?: [latitude: number, longitude: number];
+ /**
+ * The maximum distance from the given coordinate to the new coordinate.
+ *
+ * @default 10
+ */
radius?: number;
+ /**
+ * If `true` assume the radius to be in kilometers. If `false` for miles.
+ *
+ * @default false
+ */
isMetric?: boolean;
}): [latitude: number, longitude: number];
/**
@@ -1121,8 +1134,8 @@ export class LocationModule extends ModuleBase {
* If no coordinate is given, a random one will be chosen.
* @param options.radius The maximum distance from the given coordinate to the new coordinate. Defaults to `10`.
* @param options.isMetric If `true` assume the radius to be in kilometers. If `false` for miles. Defaults to `false`.
- * @param legacyRadius Deprecated, use `options.radius` instead.
- * @param legacyIsMetric Deprecated, use `options.isMetric` instead.
+ * @param legacyRadius Deprecated, use `options.radius` instead. Defaults to `10`.
+ * @param legacyIsMetric Deprecated, use `options.isMetric` instead. Defaults to `false`.
*
* @example
* faker.location.nearbyGPSCoordinate() // [ 33.8475, -170.5953 ]
@@ -1135,8 +1148,21 @@ export class LocationModule extends ModuleBase {
options?:
| [latitude: number, longitude: number]
| {
+ /**
+ * The original coordinate to get a new coordinate close to.
+ */
origin?: [latitude: number, longitude: number];
+ /**
+ * The maximum distance from the given coordinate to the new coordinate.
+ *
+ * @default 10
+ */
radius?: number;
+ /**
+ * If `true` assume the radius to be in kilometers. If `false` for miles.
+ *
+ * @default false
+ */
isMetric?: boolean;
},
legacyRadius?: number,
diff --git a/src/modules/number/index.ts b/src/modules/number/index.ts
index 85272aff..de32af25 100644
--- a/src/modules/number/index.ts
+++ b/src/modules/number/index.ts
@@ -20,7 +20,7 @@ export class NumberModule extends SimpleModuleBase {
* Returns a single random integer between zero and the given max value or the given range.
* The bounds are inclusive.
*
- * @param options Maximum value or options object. Defaults to `{}`.
+ * @param options Maximum value or options object.
* @param options.min Lower bound for generated number. Defaults to `0`.
* @param options.max Upper bound for generated number. Defaults to `Number.MAX_SAFE_INTEGER`.
*
@@ -87,7 +87,7 @@ export class NumberModule extends SimpleModuleBase {
* Returns a single random floating-point number for a given precision or range and precision.
* The lower bound is inclusive, the upper bound is exclusive, unless precision is passed.
*
- * @param options Upper bound or options object. Defaults to `{}`.
+ * @param options Upper bound or options object.
* @param options.min Lower bound for generated number. Defaults to `0.0`.
* @param options.max Upper bound for generated number. Defaults to `1.0`.
* @param options.precision Precision of the generated number, for example `0.01` will round to 2 decimal points.
@@ -164,7 +164,7 @@ export class NumberModule extends SimpleModuleBase {
* Returns a [binary](https://en.wikipedia.org/wiki/Binary_number) number.
* The bounds are inclusive.
*
- * @param options Maximum value or options object. Defaults to `{}`.
+ * @param options Maximum value or options object.
* @param options.min Lower bound for generated number. Defaults to `0`.
* @param options.max Upper bound for generated number. Defaults to `1`.
*
@@ -213,7 +213,7 @@ export class NumberModule extends SimpleModuleBase {
* Returns an [octal](https://en.wikipedia.org/wiki/Octal) number.
* The bounds are inclusive.
*
- * @param options Maximum value or options object. Defaults to `{}`.
+ * @param options Maximum value or options object.
* @param options.min Lower bound for generated number. Defaults to `0`.
* @param options.max Upper bound for generated number. Defaults to `7`.
*
@@ -262,7 +262,7 @@ export class NumberModule extends SimpleModuleBase {
* Returns a lowercase [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number.
* The bounds are inclusive.
*
- * @param options Maximum value or options object. Defaults to `{}`.
+ * @param options Maximum value or options object.
* @param options.min Lower bound for generated number. Defaults to `0`.
* @param options.max Upper bound for generated number. Defaults to `15`.
*
@@ -309,7 +309,7 @@ export class NumberModule extends SimpleModuleBase {
* Returns a [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type) number.
* The bounds are inclusive.
*
- * @param options Maximum value or options object. Defaults to `{}`.
+ * @param options Maximum value or options object.
* @param options.min Lower bound for generated bigint. Defaults to `0n`.
* @param options.max Upper bound for generated bigint. Defaults to `min + 999999999999999n`.
*
diff --git a/src/modules/person/index.ts b/src/modules/person/index.ts
index f5f4778c..e0f4b6b0 100644
--- a/src/modules/person/index.ts
+++ b/src/modules/person/index.ts
@@ -174,7 +174,7 @@ export class PersonModule extends ModuleBase {
/**
* Generates a random full name.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.firstName The optional first name to use. If not specified a random one will be chosen.
* @param options.lastName The optional last name to use. If not specified a random one will be chosen.
* @param options.sex The optional sex to use. Can be either `'female'` or `'male'`.
diff --git a/src/modules/random/index.ts b/src/modules/random/index.ts
index 98d28bc5..997583c1 100644
--- a/src/modules/random/index.ts
+++ b/src/modules/random/index.ts
@@ -215,7 +215,7 @@ export class RandomModule extends ModuleBase {
/**
* Generating a string consisting of letters in the English alphabet.
*
- * @param options Either the number of characters or an options instance. Defaults to `{ count: 1, casing: 'mixed', bannedChars: [] }`.
+ * @param options Either the number of characters or an options instance.
* @param options.count The number of characters to generate. Defaults to `1`.
* @param options.casing The casing of the characters. Defaults to `'mixed'`.
* @param options.bannedChars An array with characters to exclude. Defaults to `[]`.
@@ -276,7 +276,7 @@ export class RandomModule extends ModuleBase {
* Generating a string consisting of alpha characters and digits.
*
* @param count The number of characters and digits to generate. Defaults to `1`.
- * @param options The options to use. Defaults to `{ bannedChars: [] }`.
+ * @param options The options to use.
* @param options.casing The casing of the characters. Defaults to `'lower'`.
* @param options.bannedChars An array of characters and digits which should be banned in the generated string. Defaults to `[]`.
*
@@ -325,7 +325,7 @@ export class RandomModule extends ModuleBase {
* Generates a given length string of digits.
*
* @param length The number of digits to generate. Defaults to `1`.
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.allowLeadingZeros Whether leading zeros are allowed or not. Defaults to `true`.
* @param options.bannedDigits An array of digits which should be banned in the generated string. Defaults to `[]`.
*
diff --git a/src/modules/string/index.ts b/src/modules/string/index.ts
index 923c5286..e841e29d 100644
--- a/src/modules/string/index.ts
+++ b/src/modules/string/index.ts
@@ -351,6 +351,11 @@ export class StringModule extends SimpleModuleBase {
*/
binary(
options: {
+ /**
+ * The number or range of characters to generate after the prefix.
+ *
+ * @default 1
+ */
length?:
| number
| {
@@ -363,6 +368,11 @@ export class StringModule extends SimpleModuleBase {
*/
max: number;
};
+ /**
+ * Prefix for the generated number.
+ *
+ * @default '0b'
+ */
prefix?: string;
} = {}
): string {
@@ -393,6 +403,11 @@ export class StringModule extends SimpleModuleBase {
*/
octal(
options: {
+ /**
+ * The number or range of characters to generate after the prefix.
+ *
+ * @default 1
+ */
length?:
| number
| {
@@ -405,6 +420,11 @@ export class StringModule extends SimpleModuleBase {
*/
max: number;
};
+ /**
+ * Prefix for the generated number.
+ *
+ * @default '0o'
+ */
prefix?: string;
} = {}
): string {
diff --git a/src/modules/system/index.ts b/src/modules/system/index.ts
index fa38d6ce..4c6e010f 100644
--- a/src/modules/system/index.ts
+++ b/src/modules/system/index.ts
@@ -226,7 +226,7 @@ export class SystemModule extends ModuleBase {
/**
* Returns a random [network interface](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-understanding_the_predictable_network_interface_device_names).
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.interfaceType The interface type. Can be one of `en`, `wl`, `ww`.
* @param options.interfaceSchema The interface schema. Can be one of `index`, `slot`, `mac`, `pci`.
*