This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@fippli/array-utils

1.0.6 • Public • Published

JavaScript Array Utils

Help functions for JavaScript Arrays

[!]

This package might be a mess and be broken from time to time. Will try to make it stable but no guarantees.

Installation

npm install @fippli/array-utils

or

yarn add @fippli/array-utils

How to use

sortObjectArray

Sorts array with objects.

Arguments Description Example
Object array Array with javascript objects [{name: "Optimus prime", type: "Transformer"}, {name: "Batman", type: "Superhero"}, {name: "Magikarp", type: "Pokémon"}]
Key Object key that the array should be sorted on "name"
Reverse Boolean indicating if the sorted order should be reversed true

Example:

const characters = [
    {name: "Optimus prime", type: "Transformer"}, 
    {name: "Batman", type: "Superhero"}, 
    {name: "Magikarp", type: "Pokémon"} 
];

sortObjectArray( characters, "name", false );
// Returns:
// [{name: "Batman", type: "Superhero"}, 
//  {name: "Magikarp", type: "Pokémon"} 
//  {name: "Optimus prime", type: "Transformer"}]
         

Bug reports and feature requests are welcome :)

Readme

Keywords

none

Package Sidebar

Install

npm i @fippli/array-utils

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

21.6 kB

Total Files

4

Last publish

Collaborators

  • fippli