Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andreruffert/closest-number

πŸ”’ Find the closest number out of an array to a specific value
https://github.com/andreruffert/closest-number

array closest closest-number number

Last synced: 2 months ago
JSON representation

πŸ”’ Find the closest number out of an array to a specific value

Awesome Lists containing this project

README

        

# closest-number

[![CI status](https://github.com/andreruffert/closest-number/workflows/CI/badge.svg)](https://github.com/andreruffert/closest-number/actions?workflow=CI)
[![npm version](https://img.shields.io/npm/v/closest-number.svg)](https://www.npmjs.com/package/closest-number)
[![npm](https://img.shields.io/npm/dm/closest-number?logo=npm)](https://www.npmjs.com/package/closest-number)

> Find the closest number out of an array to a specific value

## Install

```console
$ npm i closest-number
```

## Usage

```js
const closestNumber = require('closest-number');

closestNumber([10, 20, 30], 12);
// => 10
```

## License

MIT Β© [AndrΓ© Ruffert](http://andreruffert.com)