Nominally Patriotic Meathead
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    keysortpublic

    keysort

    Sorts an Array of Objects based on key values, like an SQL ORDER BY

    build status

    Example

    var arr = [{abc: 123124, xyz: 5}, {abc: 123124, xyz: 6}, {abc: 2, xyz: 5}];
     
    keysort(arr, "abc, xyz"); // [{abc: 2, xyz: 5}, {abc: 123124, xyz: 5}, {abc: 123124, xyz: 6}]; 
    keysort(arr, "abc, xyz desc"); // [{abc: 2, xyz: 5}, {abc: 123124, xyz: 6}, {abc: 123124, xyz: 5}]; 

    What is Supported?

    • AMD loaders (require.js, cujo.js, etc.)
    • node.js (npm install keysort)
    • script tag

    License

    Copyright (c) 2017 Jason Mulligan
    Licensed under the BSD-3 license.

    install

    npm i keysort

    Downloadslast 7 days

    3

    version

    1.0.2

    license

    BSD-3-Clause

    repository

    github.com

    last publish

    collaborators

    • avatar