# objects-and-arrays-pipes

> ## Sort Pipe

Latest version **2.2.3** (published 2019-10-17) · 0 weekly downloads

## Install

```sh
npm install objects-and-arrays-pipes
pnpm add objects-and-arrays-pipes
yarn add objects-and-arrays-pipes
bun add objects-and-arrays-pipes
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.3 |
| Published | 2019-10-17 |
| First published | 2018-12-11 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 122.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | urielcuriel |

## Links

- npm: https://www.npmjs.com/package/objects-and-arrays-pipes
- npm.io page: https://npm.io/package/objects-and-arrays-pipes

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Recent versions

- 2.2.3 (latest) — 2019-10-17
- 2.0.3 — 2018-12-11

## README

# Pipes for Sort and Group Arrays and Convert Object in Array

## Sort Pipe

this pipe sort an array by property in the inner items,

``` js
const items = [{
        name: {
            first: 'Ann',
            last:'Summers'
        },
        score: '99'
    },
    {
        name: {
            first: 'John',
            last:'Nyugen'
        },
        score: '72'
    },
    {
        name: {
            first: 'Javier',
            last:'Trujillo'
        },
        score: '45'
    },
    {
        name: {
            first: 'Rose',
            last:'Jacobs',
        },
        score: '63'
    },
]
```
Only accept `String Number and Date` types
``` html
<ul>
    <li *ngFor="let item of items | sortBy:['-score']"></li>
</ul>
```

the **ASC** order is implicit, for **DESC** order use a `-` before property name 

``` html
<ul>
    <li *ngFor="let item of items | sortBy:['-score']">{{item.name}} - {{item.score}}</li>
</ul>
```

you can use nested properties

``` html
<ul>
    <li *ngFor="let item of items | sortBy:['-score']">{{item.name}} - {{item.score}}</li>
</ul>
```

## OrderBy Pipe 

*documentation under construction*

---
_Source: https://npm.io/package/objects-and-arrays-pipes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
