# eode

> Eode is an amazing, hybrid, JavaScript package. It includes advanced functions for arrays and objects that lodash doesn't have!

Latest version **2.0.1** (published 2022-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install eode
pnpm add eode
yarn add eode
bun add eode
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2022-07-22 |
| First published | 2022-07-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | qaxt |
| Maintainers | qaxt |
| Keywords | array, arrays, ndarray, object, objects, logic |

## Links

- npm: https://www.npmjs.com/package/eode
- Repository: https://github.com/qaxt/eode
- Homepage: https://github.com/qaxt
- Issues: https://github.com/qaxt/eode/issues
- npm.io page: https://npm.io/package/eode

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2022-07-22
- 2.0.0 — 2022-07-22
- 1.1.1 — 2022-07-16
- 1.1.0 — 2022-07-16

## README

# Eode
Eode is an amazing, hybrid, JavaScript package. It includes advanced functions for arrays and objects that lodash doesn't have!

## Installation
```sh
npm i eode
```

## Usage
### CJS
```js
const _ = require('eode')
```

### ESM
```js
import _ from "eode"
```

## Examples
Eode offers the powerful `_.must` function. It allows dynamic filtration and distillation of arrays of objects. More functions will be added to eode in the future, but some of the best are shown below. 
```js
console.log(_.chunk([0, 'text', [], {}], 3))
// [[0, 'text', []], [{}]]

console.log(_.eq([], []))
console.log(_.eq([0, 'text'], [0, 'text']))
console.log(_.eq([0, 'text', [], {}], [0, 'text', [], {}]))
console.log(_.eq({}, {}))
console.log(_.eq({ a: 0 }, { a: 0 }))
console.log(_.eq({ a: 0, b: [] }, { a: 0, b: [] }))
// true

const users = [
  {
    name: 'John',
    age: 18,
    deleted: false
  },
  {
    name: 'Jane',
    age: 13,
    deleted: false
  },
  {
    name: 'Bob',
    age: 69,
    deleted: true
  },
]

console.log(_.filter(users, _.must({ age: '> 16' })))
// [{ name: 'John', age: 18, deleted: false }, { name: 'Bob', age: 69, deleted: true }]
console.log(_.filter(users, { age: 13 })) // _.matches shorthand
// [{ name: 'Jane', age: 18, deleted: false }]
console.log(_.filter(users, ['name', 'John'])) // _.matchesProperty shorthand
// [{ name: 'John', age: 18, deleted: false }]
console.log(_.filter(users, 'deleted')) // _.property shorthand
// [{ name: 'Bob', age: 69, deleted: true }]

console.log(_.find(users, _.must({ age: '> 16' })))
// { name: 'John', age: 18, deleted: false }
console.log(_.find(users, { age: 13 })) // _.matches shorthand
// { name: 'Jane', age: 18, deleted: false }
console.log(_.find(users, ['name', 'John'])) // _.matchesProperty shorthand
// { name: 'John', age: 18, deleted: false }
console.log(_.find(users, 'deleted')) // _.property shorthand
// { name: 'Bob', age: 69, deleted: true }

console.log(_.findIndexes(users, _.must({ age: '> 16' })))
// [0, 2]
console.log(_.findIndexes(users, { age: 13 })) // _.matches shorthand
// [1]
console.log(_.findIndexes(users, ['name', 'John'])) // _.matchesProperty shorthand
// [0]
console.log(_.findIndexes(users, 'deleted')) // _.property shorthand
// [2]

console.log(_.distill(users, _.must({ age: ['&&', '>= 13', '<= 18'] })))
// [[John, Jane], [Bob]]
console.log(_.distill(users, { age: 18 })) // _.matches shorthand
// Array of length 2
console.log(_.distill(users, ['name', 'John'])) // _.matchesProperty shorthand
// Array of length 2
console.log(_.distill(users, 'deleted')) // _.property shorthand
// Array of length 2

console.log(_.includes([0, 'text', [], {}], {}))
// true

console.log(_.unite([0, 'text', [], {}], [0, 'text'], [0, 'text', [], {}]))
// [0, 'text', [], {}, 0, 'text', 0, 'text', [], {}]
console.log(_.unite([0, 'text', [], {}], 'string'))
// [0, 'text', [], {}, 'string']

console.log(_.subtract([0, 'text', [], {}, [0, 1]], [0, []], [{}]))
// ['text', [0, 1]]

console.log(_.intersect([0, 'text', [], {}], [0, 'text'], ['text', {}]))
// ['text', 'text', 'text']

console.log(_.exclude([0, 'text', [], {}], [0, 'text'], ['text', {}]))
// [[]]

console.log(_.mapKeys({ apple: 'alpha', ball: 'beta' }, k => k[0]))
// { a: 'alpha', b: 'beta' }

console.log(_.mapValues({ apple: 'alpha', ball: 'beta' }, v => v[0]))
// { apple: 'a', ball: 'b' }

console.log(_.unique([0, 'text', [], {}, 'text', {}]))
// [0, 'text', [], {}]

for (let num of _.range(10, 0, 2)) {
  console.log(num)
}

console.log(_.search([[], {}, 'a', 'b', 'c'], {})) // binary search
// 1

console.log(_.shuffle([0, 1, 2, 3], 2))
// [2, 3, 0, 1]

console.log(_.zip(['id', 0, 1, 2], ['username', 'qaxt', 'bob', 'npm']))
// [['id', 'username'], [0, 'qaxt'], [1, 'bob'], [2, 'npm']]

console.log(_.indexes([0, 'text', [], {}, 'text', ['text']], 'text'))
// [1, 4]

console.log(_.last([0, 'text', [], {}]))
// {}
console.log(_.last(_.indexes([0, 'text', [], {}, 'text', ['text']], 'text')))
// 4

console.log(_.factors(-12))
// [1, -12, -1, 12, 2, -6, -2, 6, 3, -4, -3, 4]

console.log(_.insert([0, 'text', [], {}], 2, { a: 0 }))
// 

console.log(_.fromPairs([['a', 0], ['b', []]]))
// { a: 0, b: [] }

console.log(_.iterate([['id', 0, 1, 2], ['username', 'qaxt', 'bob', 'npm']], (a) => {
  return a
}))
// same output as _.zip(['id', 0, 1, 2], ['username', 'qaxt', 'bob', 'npm'])

const space = _.ndarray(2, 3)
console.log(space)
/*
{
  length: 2,
  dimensions: 3,
  data: [
    0, 1, 2, 3,
    4, 5, 6, 7
  ]
} 
*/

console.log(_.ndindex([1, 0, 1], space.length))
// 5
console.log(space.data[_.ndindex([1, 0, 1], space.length)])
// [1, 0, 1]

console.log(_.ndpoint(5, space.length, space.dimensions))
// [1, 0, 1]
```

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