-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from turingsecure/80-typescript-types
chore: generate typescript types automatically on build
- Loading branch information
Showing
8 changed files
with
151 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export = CVSS; | ||
/** | ||
* Creates a new CVSS object | ||
* | ||
* @param {String} vector | ||
*/ | ||
declare function CVSS(vector: string): { | ||
vector: string; | ||
getScore: () => number; | ||
getTemporalScore: () => number; | ||
getEnvironmentalScore: () => number; | ||
getRating: () => string; | ||
getTemporalRating: () => string; | ||
getEnvironmentalRating: () => string; | ||
getVectorObject: () => any; | ||
getDetailedVectorObject: () => any; | ||
getVersion: () => string; | ||
getCleanVectorString: () => string; | ||
isValid: true; | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Parses the vector to a number score | ||
* | ||
* @returns {Number} Calculated Score | ||
*/ | ||
export function getScore(vector: any): number; | ||
/** | ||
* Parses the vector to the temporal score | ||
* | ||
* @returns {Number} Temporal Score | ||
*/ | ||
export function getTemporalScore(vector: any): number; | ||
/** | ||
* Parses the vector to the environmental score | ||
* | ||
* @returns {Number} Environmental Score | ||
*/ | ||
export function getEnvironmentalScore(vector: any): number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* @param {Number} num The number to round | ||
* | ||
* @returns The rounded number | ||
*/ | ||
export function roundUpExact(num: number): number; | ||
/** | ||
* @param {Number} num The number to round | ||
* @param {Number} precision The number of decimal places to preserve | ||
* | ||
* @returns The rounded number | ||
*/ | ||
export function roundUpApprox(num: number, precision: number): number; | ||
/** | ||
* Retrieves an object of vector's metrics | ||
* | ||
* @param {String} vector | ||
* @returns {Object} Abbreviations & Vector Value pair | ||
*/ | ||
export function getVectorObject(vector: string): any; | ||
/** | ||
* Retrieves an object of vector's metrics | ||
* | ||
* @param {String} vector | ||
* @returns {Object} Abbreviations & Vectors Detailed Values | ||
*/ | ||
export function getDetailedVectorObject(vector: string): any; | ||
/** | ||
* Finds the vector's metric by it's abbreviation | ||
* | ||
* @param {String} abbr | ||
*/ | ||
export function findMetric(abbr: string): any; | ||
/** | ||
* Finds the vector's value for a specific metric | ||
* | ||
* @param {String} abbr | ||
* @param {Object} vectorObject | ||
*/ | ||
export function findMetricValue(abbr: string, vectorObject: any): any; | ||
/** | ||
* Calculates the rating of the given vector | ||
* | ||
* @param Score calculated score from getScore() in cvss.js | ||
* @returns {String} returns one of the five possible ratings | ||
*/ | ||
export function getRating(score: any): string; | ||
/** | ||
* Checks whether the vector passed is valid | ||
* | ||
* @param {String} vector | ||
* @returns {Boolean} result with whether the vector is valid or not | ||
*/ | ||
export function isVectorValid(vector: string): boolean; | ||
/** | ||
* This transforms an object in the format of getVectorObject() | ||
* and parses it to a CVSS comaptible string | ||
* | ||
* @param {Object} obj | ||
*/ | ||
export function parseVectorObjectToString(obj: any): string; | ||
/** | ||
* Retrives the version from the vector string | ||
* | ||
* @return {String} returns the version number | ||
*/ | ||
export function getVersion(vector: any): string; | ||
/** | ||
* Returns a vector without undefined values | ||
* | ||
* @param {String} vector | ||
* @returns {String} Vector without undefined values | ||
*/ | ||
export function getCleanVectorString(vector: string): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"include": ["lib/**/*"], | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters