# @snigo.dev/cf

> Compare functions

Latest version **0.0.6** (published 2021-02-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @snigo.dev/cf
pnpm add @snigo.dev/cf
yarn add @snigo.dev/cf
bun add @snigo.dev/cf
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2021-02-23 |
| First published | 2021-01-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 41.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | snigo.ogins |

## Links

- npm: https://www.npmjs.com/package/@snigo.dev/cf
- Repository: https://github.com/snigo/snigo.dev
- Homepage: https://github.com/snigo/snigo.dev#readme
- Issues: https://github.com/snigo/snigo.dev/issues
- npm.io page: https://npm.io/package/@snigo.dev/cf

## Dependencies (1)

- [@snigo.dev/isit](https://npm.io/package/@snigo.dev/isit.md) ^0.0.6

## Recent versions

- 0.0.6 (latest) — 2021-02-23
- 0.0.5 — 2021-02-23
- 0.0.4 — 2021-02-22
- 0.0.3 — 2021-01-30

## README

# `@snigo.dev/cf`

Collection of compare functions for everyday use, providing three different methods of sorting:
- Alphanumeric: standard sorting by character code
- Numeric: numbers sorted before any textual content
- DateTime: sorting by parsable date (based on `Date.parse`)

## Usage

```js
import { cfDateTimeBy } from '@snigo.dev/cf';

const users = [
  { name: 'Jeff', dob: 'January 12, 1964' },
  { name: 'Elon', dob: 'June 28, 1971' },
  { name: 'Bill', dob: 'October 28, 1955' },
  { name: 'Mark', dob: 'May 14, 1984' },
];

[...users].sort(cfDateTimeBy('dob', 'desc'));
/**
 * => [
 *   { name: 'Mark', dob: 'May 14, 1984' },
 *   { name: 'Elon', dob: 'June 28, 1971' },
 *   { name: 'Jeff', dob: 'January 12, 1964' },
 *   { name: 'Bill', dob: 'October 28, 1955' },
 * ]
 * /
```

## Motivation

Provide higher comparing abstraction for sorting methods.

## API

---
_Source: https://npm.io/package/@snigo.dev/cf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
