From f4b2053c33ad6592f257546f9c4256464ce5c135 Mon Sep 17 00:00:00 2001 From: Luke Watts Date: Sat, 10 Sep 2022 09:25:08 +0200 Subject: [PATCH] chore: export types for security module --- src/index.ts | 1 + src/internal/toDate.ts | 2 ++ src/modules/security/index.ts | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 984a8c758d5..c5661f952ea 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,7 @@ export type { GenderType, NameModule, SexType } from './modules/name'; export type { PhoneModule } from './modules/phone'; export type { RandomModule } from './modules/random'; export type { ChemicalElement, ScienceModule, Unit } from './modules/science'; +export type { Cvss, SecurityModule, SeverityRating } from './modules/security'; export type { SystemModule } from './modules/system'; export type { UniqueModule } from './modules/unique'; export type { VehicleModule } from './modules/vehicle'; diff --git a/src/internal/toDate.ts b/src/internal/toDate.ts index 52988468277..86ea3e8fd06 100644 --- a/src/internal/toDate.ts +++ b/src/internal/toDate.ts @@ -3,6 +3,8 @@ * If nothing or a non parseable value is passed, takes current date. * * @param date The input to convert to a date. + * + * @since 8.0.0 */ export function toDate(date?: string | Date | number): Date { date = new Date(date); diff --git a/src/modules/security/index.ts b/src/modules/security/index.ts index ca280ab8a2b..2247c4f9f72 100644 --- a/src/modules/security/index.ts +++ b/src/modules/security/index.ts @@ -33,7 +33,7 @@ export interface Cvss { /** * Possible textual rating definitions for a CVSS identifier */ -type SeverityRating = 'none' | 'low' | 'medium' | 'high' | 'critical'; +export type SeverityRating = 'none' | 'low' | 'medium' | 'high' | 'critical'; /** * Module to generate security related entries. @@ -63,6 +63,8 @@ export class SecurityModule { * faker.security.cve({ from:'2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z' }) // 'CVE-2028-0762' * faker.security.cve({ from:'2020-01-01T00:00:00.000Z' }) // 'CVE-2028-0762' * faker.security.cve({ to: '2019-12-31T00:00:00.000Z' }) // 'CVE-2018-0762' + * + * @since 8.0.0 */ cve( options: { @@ -89,6 +91,8 @@ export class SecurityModule { * * @example * faker.security.cwe() // 'CWE-123' + * + * @since 8.0.0 */ cwe(): string { return ['CWE', this.faker.datatype.number({ min: 0, max: 1388 })].join('-'); @@ -101,6 +105,8 @@ export class SecurityModule { * * @example * faker.security.cvss() // { score: 3.8, vector: 'CVSS:3.1/AV:P/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N/E:P/RL:W/RC:C', rating: 'low' } + * + * @since 8.0.0 */ cvss(): Cvss { const score = this.faker.datatype.float({