arraysort

Array sorting utility.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
arraysort
102.0.07 years ago7 years agoMinified + gzip package size for arraysort in KB

Readme

arraysort


!Build Statusbdtravisshieldurlbdtravisurl !Code Climatebdcodeclimateshieldurlbdcodeclimateurl !Code Coveragebdcodeclimatecoverageshieldurlbdcodeclimateurl !npm Versionbdnpmshieldurlbdnpmurl


Array sorting utility.



Installation

npm install arraysort --save



Usage

Sort Strings

arraysort.stringCompare(options) create a function which sort entries by string comparing.
"use strict";

const arraysort = require('arraysort');

// Define a sort function.
let stringAsc = arraysort.stringCompare(),
    stringDesc = arraysort.stringCompare({desc: true});

// Execute sorting.
let values = ['foo', 'bar', 'baz'];
values = values.sort(stringAsc); // -> ['foo', 'baz', 'bar']
values = values.sort(stringDesc); // -> ['bar', 'baz', 'foo']



License

This software is released under the MIT License.

Links