JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q40917F
  • License ISC

Sort Objects based on priority

Package Exports

  • sort-objects

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sort-objects) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sort Objects

sort-objects is a js library for sorting array of objects based on priority.

Installation

Use the package manager [npm] to install sort-objects.

npm i sort-objects

Usage

let ps = require('sort-objects')

let objects = [
    {
        name:"test",
        age:12,
        nested:{
            properties:12
        }
    },
    {
        name:"test",
        age:12,
        nested:{
            properties:2
        }
    }
]
objects.sort(ps.prioritySort(['name','age','nested.properties']));
console.log(objects)```