Skip to content

Commit

Permalink
chore: export types for security module
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed Sep 13, 2022
1 parent 3901aac commit f4b2053
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 2 additions & 0 deletions src/internal/toDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion src/modules/security/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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: {
Expand All @@ -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('-');
Expand All @@ -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({
Expand Down

0 comments on commit f4b2053

Please sign in to comment.