aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJoscha Feth <[email protected]>2024-10-12 14:39:42 +0100
committerGitHub <[email protected]>2024-10-12 15:39:42 +0200
commit4056ab09c64be40d41562284ec64e7531fbaff41 (patch)
treef33217e1fb0d98b52f6076421aaca98757d52aac /src/modules
parent033c23b109de18dcfaf8abeab4e134a47c57b460 (diff)
downloadfaker-4056ab09c64be40d41562284ec64e7531fbaff41.tar.xz
faker-4056ab09c64be40d41562284ec64e7531fbaff41.zip
feat(location): add `continent` method (#3162)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/location/index.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts
index 4aabdd8d..4a49e029 100644
--- a/src/modules/location/index.ts
+++ b/src/modules/location/index.ts
@@ -217,6 +217,20 @@ export class LocationModule extends ModuleBase {
}
/**
+ * Returns a random continent name.
+ *
+ * @example
+ * faker.location.continent() // 'Asia'
+ *
+ * @since 9.1.0
+ */
+ continent(): string {
+ return this.faker.helpers.arrayElement(
+ this.faker.definitions.location.continent
+ );
+ }
+
+ /**
* 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.