Skip to content

mjmiller41/object-to-sorted-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object-prototype-sort

Sort an object by key or value

Report Bug | Request Features


Table of Contents


Install

npm i object-to-sorted-array

Import

import sortObj from 'object-to-sorted-array';

Syntax

sortObj(object);

sortObj(object[, sortBy])

sortObj(object[, sortBy[, sortOrder]])

Parameters

  • object

    • object to de sorted
  • sortBy (optional)

    • "key" | "value"
    • sort by the objects keys or values
  • order (optional)

    • "ascending" | "descending"
    • sort in ascending or descending order

Return value

  • Returns an array of sorted key/value pair arrays
    • [['key', 'value'], ...]

License

Distributed under the MIT License. See LICENSE for more information.


Contact

Project Link: https://github.com/michael-joseph-miller/object-prototype-sort

About

Adds sort method to Object class

Resources

License

Stars

Watchers

Forks

Packages

No packages published