open-index/open-npm huggingface dataset:
npm package: @reverse/array
Description: Useful functions for managing arrays.
Latest version: 1.7.3

# @reverse/array

> Useful functions for managing arrays.

## Install

```
npm install @reverse/array
```

## Table of Contents

- [moveIndex](#moveIndexarray-oldIndex-newIndex)
- [removeAt](#removeAtarray-index)
- [removeBy](#removeByarray-value)
- [shuffle](#shufflearray)
- [unique](#uniquearray)

---

## Usage

### moveIndex(array, oldIndex, newIndex)

> Moves an element in an array to a new part of the array.

#### Parameters

- `array: Array`: The array to modify.
- - `oldIndex: Number`: The index of the item to move.
- - `newIndex: Number`: The new index of the item to move.

#### Example

```js
import { moveIndex } from '@reverse/array';

moveIndex([1, 2, 3], 0, 2);
// [2, 3, 1]
```

### removeAt(array, index)

> Removes an element from an array by it's index.

#### Parameters

- `array: Array`: The array to modify.
- `index: Number` The index to remove.

#### Example

```js
import { removeAt } from '@reverse/array';

removeAt([1, 2, 3], 1);
// [1, 3]
```

### removeBy(array, value)

> Removes an element from an array by it's value.

#### Parameters

- `array: Array`: The array to modify.
- `value: any` The element to remove.

#### Example

```js
import { removeBy } from '@reverse/array';

removeBy(['A', 'B', 'C'], 'B');
// ['A', 'C']
```

### shuffle(array)

> Shuffles an array and returns it.

#### Paramerters

- `array: Array`: The array to shuffle.

#### Example

```js
import { shuffle } from '@reverse/array';

shuffle([1, 2, 3]);
// Example Output: [2, 3, 1]
```

### unique(array)

> Returns an array of all the unique values of an array. (i.e. Removes duplicate values.)

#### Parameters

- `array: Array`: The array to modify.

#### Example

```js
import { unique } from '@reverse/array';

unique([1, 1, 2, 3, 4, 4, 4, 4, 5]);
// [1, 2, 3, 4, 5]
```
npm package: @reverse/callback
Description: Little callbacks.
Latest version: 1.0.4

# @reverse/callback
> Little callbacks you can use to work faster.

I wrote these since I was tired of repeating some of the same code, so I threw
these little things in a helper function package.

You can install with nodejs and npm
```
npm i @reverse/callback
```

## Table of Contents**
- [identity](#identity)
- [call](#call)
- [propEquals](#propEquals-[generator])

## identity
Returns the passed argument.
```js
export const identity = (x) => x;
```
Calls the passed argument.
```js
export const call = (x) => x();
```

Useful for calling everything in an array: `functionArray.forEach(call);`

## propEquals [generator]
Creates a callback for if the passed argument's property equals a certain value.
```js
const propEquals = (prop, value) => (item) => item[prop] === value;
```

Useful for finding an item in an array using .find()
`array.find(propEquals('name', 'dave'));`
npm package: @reverse/compact
Description: Functions for compacting numbers.
Latest version: 1.1.4

# @reverse/compact

> Functions for compacting numbers.

## Install

```
npm install @reverse/compact
```

## Table of Contents

- [compactNumber](#compactNumbernum-zeroDecimal)
- [compactMiniNumber](#compactMiniNumbernum)
- [compactTime](#compactTimeseconds)

---

## Usage

This package uses the following letters for compacting numbers:

```js
let compactNumberMap = {
  4: 'K', // 1,000 -> 1K (only in compactMini)
  7: 'M', // 1,000,000 -> 1M
  10: 'B', // 1,000,000,000 -> 1B
  13: 'T', // 1,000,000,000,000 -> 1T
  16: 'Q', // 1,000,000,000,000,000 -> 1Q
  19: 'q', // 1,000,000,000,000,000,000 -> 1q
  22: 'S', // 1,000,000,000,000,000,000,000 -> 1S
  25: 's', // 1,000,000,000,000,000,000,000,000 -> 1s
  28: 'O', // 1,000,000,000,000,000,000,000,000,000 -> 1O
  31: 'N', // 1,000,000,000,000,000,000,000,000,000,000 -> 1N
  34: 'D', // 1,000,000,000,000,000,000,000,000,000,000,000 -> 1D
};
```

### compactNumber(num, zeroDecimal)

> Compacts a number using an letter.

#### Parameters

- `num: Number`: The number to compact.
- `zeroDecimal: Boolean`: Whether or not to include a `.0` at the end of a number.

#### Example

```js
import { compactNumber } from '@reverse/compact';

compactNumber(1000000, false);
// "1M"

compactNumber(1500000, false);
// "1.5M"

compactNumber(2000000, true);
// "2.0M"
```

### compactMiniNumber(num)

> Compacts a number, with support for the K (1,000) unit.

#### Parameters

- `num: Number`: The number to compact.

#### Example

```js
import { compactMiniNumber } from '@reverse/compact';

compactMiniNumber(1000000);
// "1M"

compactMiniNumber(1500);
// "1.5K"
```

### compactTime(seconds)

> Compacts seconds to days, hours, minutes, and seconds.

#### Parameters

- `seconds: Number`: The amount of seconds.

#### Examples

```js
import { compactTime } from '@reverse/compact';

compactTime(1234567890);
// "14288 Days 23 Hours 31 Minutes 30 Seconds"
```
npm package: @reverse/date
Description: Useful functions for handling dates.
Latest version: 1.1.10

# @reverse/date

> Useful functions for handling dates.

## Install

```
npm install @reverse/date
```

## Table of Contents

- [dateEqualsNow](#dateEqualsNowmonth-date-year)
- [formatDate](#formatDatedate)
- [getEasterDate](#getEasterDateyear)

---

## Usage

### dateEqualsNow(month, date, year)

> Checks if a given date is the same date as today.

#### Parameters

- `month: Number`: The month in a number. Leading zero optional.
- `date: Number`: The date.
- `year: Number`: The full year.

#### Example

```js
import { dateEqualsNow } from '@reverse/date';

// Assuming the today's date is 6/19/2019.

dateEqualsNow(06, 19, 2019);
// true

dateEqualsNow(04, 20, 2069);
// false
```

### formatDate(date)

> A nicely formatted date with time in AM and PM.

#### Parameters

- `date: Date`: A date to format.

#### Example

```js
import { formatDate } from '@reverse/date';

formatDate(new Date());
// Example Output: "2019-06-21 at 10:53am"
```

### getEasterDate(year)

> Finds the month and date of easter of that year.

#### Paramerters

- `year: Number`: The email to check.

#### Example

```js
import { getEasterDate } from '@reverse/date';

getEasterDate(2020);
// "04.12"
```