JSPM

@upendra.manike/array-helpers

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q45115F
    • License MIT

    Array manipulation utilities - group by, aggregate, statistics, remove duplicates, and more

    Package Exports

    • @upendra.manike/array-helpers
    • @upendra.manike/array-helpers/dist/index.js
    • @upendra.manike/array-helpers/dist/index.mjs

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@upendra.manike/array-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    array-helpers

    Array manipulation utilities - group by, aggregate, statistics, remove duplicates, and more.

    Installation

    npm install @upendra.manike/array-helpers

    Usage

    import { groupBy, average, removeDuplicates } from '@upendra.manike/array-helpers';
    
    // Grouping
    const users = [{name: 'John', role: 'admin'}, {name: 'Jane', role: 'user'}];
    groupBy(users, u => u.role); // {admin: [...], user: [...]}
    
    // Statistics
    average([1, 2, 3, 4]); // 2.5
    median([1, 2, 3, 4, 5]); // 3
    mode([1, 2, 2, 3]); // 2
    
    // Utilities
    removeDuplicates([1, 2, 2, 3]); // [1, 2, 3]
    removeFalsy([1, null, 2, undefined]); // [1, 2]

    License

    MIT