Skip to content

alex-hunter3/sort-by-field

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

A simple library for sorting an array of objects by a specified field.

Installation

npm install sort-by-field

Import

To import the main function:

import sortByField from "sort-by-field";

Other miscellaneous function: import { quicksort } from "sort-by-field";

Calling the function

To call sortByField, 2 arguments are required, the array to be sorted and the field to be sorted by.

const sequence = [
    {
        value: 5
    },
    {
        value: 2
    },
    {
        value: 6
    },
    {
        value: 7
    }
];

sequence = sortByField(sequence, "value");
console.log(sequence);

About

Simple library for sorting an array of objects by a custom field.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published