aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPiotr Kuczynski <[email protected]>2022-01-25 21:18:34 +0100
committerGitHub <[email protected]>2022-01-25 21:18:34 +0100
commitc8316246773a50f26fa1d673f868dc4bff6b14b2 (patch)
tree497792f4f6f30efccb3e3730a44c1adc653a55cb /src
parent2c82be67c4ceb6afb3ae07b8a422fcc9be7c409b (diff)
downloadfaker-c8316246773a50f26fa1d673f868dc4bff6b14b2.tar.xz
faker-c8316246773a50f26fa1d673f868dc4bff6b14b2.zip
chore: fix JSDoc comments in system.ts (#298)
Diffstat (limited to 'src')
-rw-r--r--src/system.ts63
1 files changed, 39 insertions, 24 deletions
diff --git a/src/system.ts b/src/system.ts
index 652cb277..23e65d5e 100644
--- a/src/system.ts
+++ b/src/system.ts
@@ -1,5 +1,3 @@
-// generates fake data for many computer systems properties
-
import type { Faker } from '.';
const commonFileTypes = ['video', 'audio', 'image', 'text', 'application'];
@@ -29,6 +27,9 @@ function setToArray<T>(set: Set<T>): T[] {
return array;
}
+/**
+ * Generates fake data for many computer systems properties.
+ */
export class System {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
@@ -41,9 +42,10 @@ export class System {
}
/**
- * generates a file name
+ * Returns a random file name with extension.
*
- * @method faker.system.fileName
+ * @example
+ * faker.system.fileName() // 'self_enabling_accountability_toys.kpt'
*/
fileName() {
let str = this.faker.random.words();
@@ -53,10 +55,13 @@ export class System {
}
/**
- * commonFileName
+ * Returns a random file name with a given extension or a commonly used extension.
*
- * @method faker.system.commonFileName
- * @param ext
+ * @param ext Extension
+
+ * @example
+ * faker.system.commonFileName() // 'dollar.jpg'
+ * faker.system.commonFileName('txt') // 'global_borders_wyoming.txt'
*/
commonFileName(ext): string {
let str = this.faker.random.words();
@@ -66,9 +71,10 @@ export class System {
}
/**
- * mimeType
+ * Returns a mime-type.
*
- * @method faker.system.mimeType
+ * @example
+ * faker.system.mimeType() // 'video/vnd.vivo'
*/
mimeType() {
const typeSet = new Set<string>();
@@ -95,18 +101,20 @@ export class System {
}
/**
- * Returns a commonly used file type
+ * Returns a commonly used file type.
*
- * @method faker.system.commonFileType
+ * @example
+ * faker.system.commonFileType() // 'audio'
*/
commonFileType() {
return this.faker.random.arrayElement(commonFileTypes);
}
/**
- * Returns a commonly used file extension
+ * Returns a commonly used file extension.
*
- * @method faker.system.commonFileExt
+ * @example
+ * faker.system.commonFileExt() // 'gif'
*/
commonFileExt() {
return this.faker.system.fileExt(
@@ -115,9 +123,10 @@ export class System {
}
/**
- * Returns any file type available as mime-type
+ * Returns a file type.
*
- * @method faker.system.fileType
+ * @example
+ * faker.system.fileType() // 'message'
*/
fileType() {
const typeSet = new Set<string>();
@@ -143,10 +152,13 @@ export class System {
}
/**
- * fileExt
+ * Returns a file extension.
+ *
+ * @param mimeType Valid [mime-type](https://github.com/jshttp/mime-db/blob/master/db.json)
*
- * @method faker.system.fileExt
- * @param mimeType
+ * @example
+ * faker.system.fileExt() // 'emf'
+ * faker.system.fileExt('application/json') // 'json'
*/
fileExt(mimeType?: string): string {
const typeSet = new Set<string>();
@@ -178,9 +190,10 @@ export class System {
}
/**
- * Returns directory path
+ * Returns a directory path.
*
- * @method faker.system.directoryPath
+ * @example
+ * faker.system.directoryPath() // '/etc/mail'
*/
directoryPath(): string {
const paths = this.faker.definitions.system.directoryPaths;
@@ -188,9 +201,10 @@ export class System {
}
/**
- * returns file path
+ * Returns a file path.
*
- * @method faker.system.filePath
+ * @example
+ * faker.system.filePath() // '/usr/local/src/money.rmp.dotx'
*/
filePath() {
return this.faker.fake(
@@ -199,9 +213,10 @@ export class System {
}
/**
- * semver
+ * Returns a [semantic version](https://semver.org).
*
- * @method faker.system.semver
+ * @example
+ * faker.system.semver() // '1.1.2'
*/
semver(): string {
return [