1.0.0 • Published 2 years ago

object-to-sorted-array v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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