UNPKG

@atomist/sdm-pack-aspect

Version:

an Atomist SDM Extension Pack for visualizing drift across an organization

56 lines 1.75 kB
export declare type FiveStar = 0 | 1 | 2 | 3 | 4 | 5; /** * Represents a quality ranking of a particular element of a project. */ export interface Score { readonly name: string; /** * Category this score belongs to, if any */ readonly category?: string; /** * Explanation for this score, if available */ readonly reason?: string; readonly score: FiveStar; } /** * Structure representing a score on a particular aspect of a project. */ export declare type Scores = Record<string, Score>; export declare type Weighting = 1 | 2 | 3; export interface Scored { readonly scores: Scores; } /** * Score the given object in the given context * @param scoreFunctions scoring functions. Undefined returns will be ignored * @param {T} toScore what to score * @param {CONTEXT} context * @return {Promise<Scores>} */ export declare function scoresFor<T, CONTEXT>(scoreFunctions: Array<(t: T, c: CONTEXT) => Promise<Score | undefined>>, toScore: T, context: CONTEXT): Promise<Scores>; /** * Weighting to apply to this name score. Default is 1. * Other values can be used to increase the weighting. */ export declare type ScoreWeightings = Record<string, Weighting>; export declare type WeightedScores = Record<string, Score & { weighting: Weighting; }>; export interface WeightedScore { /** * Weighted score */ weightedScore: number; /** * Individual component scores */ weightedScores: WeightedScores; } /** * Perform a weighted composite score for the given scores. * Returns a real number from 0 to 5 */ export declare function weightedCompositeScore(scored: Scored, weightings?: ScoreWeightings): WeightedScore | undefined; //# sourceMappingURL=Score.d.ts.map