Negligible Psychological Misery

    @writetome51/get-median
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.0 • Public • Published

    getMedian(numbers): number

    Returns median of numbers. Does not modify numbers.

    Examples

    getMedian([19, 3, 5, 9, 11.2, 15, 1, 7, 21, 13]);
    // --> 10.1
    
    getMedian([19, 3, 5, 7, 9, 11, 13.3, 15, 21]);
    // --> 11
    
    getMedian([1, 2, '3', '0', 4, 5, 8]);
    // --> 3
    
    // Make sure each item in array is a number, or expect the 
    // unexpected:
    
    getMedian([1, 2, 3, 'e', 4, 5, 8]);
    // --> NaN
    
    getMedian([1, 2, 3, false, 4, 5, 8]);
    // --> 3
    
    getMedian([1, 2, 3, 4, NaN, 7, 8, 9]);
    // --> NaN

    Installation

    npm i @writetome51/get-median

    Loading

    import { getMedian } from '@writetome51/get-median'; 

    Install

    npm i @writetome51/get-median

    DownloadsWeekly Downloads

    1

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    3.39 kB

    Total Files

    5

    Last publish

    Collaborators

    • writetome51