sortobject

  • Version 4.16.0
  • Published
  • 38.8 kB
  • No dependencies
  • MIT license

Install

npm i sortobject
yarn add sortobject
pnpm add sortobject

Overview

Returns a copy of an object, sorted deeply by its keys, without mangling any arrays inside of it

Index

Functions

function sortArray

sortArray: <T extends any[]>(subject: T, comparator?: KeyComparator) => T;
  • Returns a copy of the passed array, with all nested objects within it sorted deeply by their keys, without mangling any nested arrays.

    Parameter subject

    The unsorted array.

    Parameter comparator

    An optional comparator for sorting keys of objects.

    Returns

    The new sorted array.

function sortObject

sortObject: <T extends IndexedObject>(
subject: T,
comparator?: KeyComparator
) => T;
  • Returns a copy of the passed object, with all nested objects within it sorted deeply by their keys, without mangling any nested arrays inside of it.

    Parameter subject

    The unsorted object.

    Parameter comparator

    An optional comparator for sorting keys of objects.

    Returns

    The new sorted object.

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (18)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/sortobject.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/sortobject)
  • HTML
    <a href="https://www.jsdocs.io/package/sortobject"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>