/** * Utility class for _very simple_ statistics operations. * When we need to do complex and/or expensive stats, * consider introducing a dedicated stats library. * * This is here to use until that point comes */ import { NoteProps } from "."; export declare type NonEmptyArray = [T, ...T[]]; export declare class StatisticsUtils { static isNonEmptyArray(arr: T[]): arr is NonEmptyArray; static getBasicStats(arr: NonEmptyArray): { mean: number; median: number; stddev: number; max: number | undefined; }; /** * Get standard deviation from array of numbers. */ static stddev(arr: NonEmptyArray): number; /** * Get median value from array of numbers. */ static median(arr: NonEmptyArray): number; /** * Convenience command to grab a collection of statistics from a set of notes. * * Given an array of notes, aggregate and get basic statistics of the following: * * number of children, * number of links, * number of characters in body, * note depth * * This is used to grab statistics about quantifiable properties from a set of notes * for analytics purposes. * * @param notes Notes to get basic stats from * @returns an object holding all basic stats */ static getBasicStatsFromNotes(notes: NoteProps[]): { numChildren: number; numLinks: number; numChars: number; noteDepth: number; maxNumChildren: number | undefined; medianNumChildren: number; stddevNumChildren: number; maxNumLinks: number | undefined; medianNumLinks: number; stddevNumLinks: number; maxNumChars: number | undefined; medianNumChars: number; stddevNumChars: number; maxNoteDepth: number | undefined; medianNoteDepth: number; stddevNoteDepth: number; } | undefined; }