# nodash

> A port of the Haskell Prelude to JavaScript/NodeJS

Latest version **0.12.0** (published 2015-10-14) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.0 |
| Published | 2015-10-14 |
| First published | 2015-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Julian Alexander Fleischer |
| Maintainers | scravy |
| Keywords | prelude, haskell, functional, functional-programming, utility, library |

## Links

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

## Dependencies (2)

- [knuth-morris-pratt](https://npm.io/package/knuth-morris-pratt.md) ^1.0.0
- [steinhaus-johnson-trotter](https://npm.io/package/steinhaus-johnson-trotter.md) ^1.1.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.12.0 (latest) — 2015-10-14
- 0.11.1 — 2015-10-13
- 0.11.0 — 2015-10-13
- 0.10.3 — 2015-10-07
- 0.10.2 — 2015-10-07
- 0.10.1 — 2015-10-06
- 0.10.0 — 2015-10-05
- 0.9.2 — 2015-09-03
- 0.9.1 — 2015-09-03
- 0.9.0 — 2015-09-02
- 0.8.2 — 2015-08-21
- 0.8.1 — 2015-08-19
- 0.8.0 — 2015-08-06
- 0.7.1 — 2015-06-13
- 0.7.0 — 2015-06-12
- … 3 more at https://npm.io/package/nodash/versions

## README

nodash
======

[![Build Status](https://travis-ci.org/scravy/nodash.svg?branch=master)](https://travis-ci.org/scravy/nodash)
[![Dependencies](https://david-dm.org/scravy/nodash.svg)](https://david-dm.org/scravy/nodash#info=dependencies&view=table)
[![Dependencies](https://david-dm.org/scravy/nodash/dev-status.svg)](https://david-dm.org/scravy/nodash#info=devDependencies&view=table)


***nodash*** offers you a rich set of library functions, comparable to
the likes of [***underscore***](http://underscorejs.org/)
or [***lodash***](https://lodash.com/).
The functions are actually derived
from the [***Haskell Prelude***](https://hackage.haskell.org/package/base-4.7.0.0/docs/Prelude.html)
and emphasize a [functional programming style](https://www.cs.cmu.edu/~crary/819-f09/Backus78.pdf).

A special trait of this library is that it discards some JavaScript concepts
(like prototypes or optional arguments) to allow some (in the authors opinion)
more useful ones (such as currying).

Every function from this library can be thought of as *curried*, i.e. you can
partially apply any function and get a function in return (on the other hand this
means there are no optional arguments). It also supports *lists* which can be
evaluated lazily and *infinite streams*.

Browse through the
 [apidoc](https://scravy.github.io/nodash/apidoc.html),
 [benchmark](https://github.com/scravy/nodash/tree/master/benchmark/index.js), or
 [tests](https://github.com/scravy/nodash/tree/master/test) for examples.

For a list of which prelude functions are covered see the
[apidoc appendix](http://scravy.github.io/nodash/apidoc.html#Appendix).

Nodash is available via [npm](https://www.npmjs.com/package/nodash).


Example
-------

```JavaScript
Nodash.install(global || window); // node or browser

var reverse = foldl(flip(cons), []);

console.log(reverse([1,2,3])); // → [3,2,1]
```


Usage
-----

### in node

```
npm install --save nodash
```

```JavaScript
var Nodash = require('nodash');
```


### in the browser

```HTML
<script src="nodash.js"></script>
<script>
    // Nodash is available in `window.Nodash`
    document.write(Nodash.foldl(Nodash.flip(cons), []));
</script>
```


### in legacy browsers

Just pull in `es5-shim` first:

```HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.1.13/es5-shim.js"></script>
<script src="nodash.js"></script>
```


### `install(mountpoint)`

It is possible to attach the Nodash functions directly
to the global object (in fact, any object), optionally
with a prefix or postfix:

```JavaScript
Nodash.install(global);           → foldl(flip(cons), []);
Nodash.install([ '$', global ]);  → $foldl($flip($cons), []);
Nodash.install([ global, '_' ]);  → foldl_(flip_(cons_), []);
Nodash.install([ 'f_', global ]); → f_foldl(f_flip(f_cons), []);
```

Both a prefix and a postfix works too:

```JavaScript
Nodash.install([ '__', global, '__' ]); → __foldl__(__flip__(__cons__), []);
```


License
-------

    Copyright (c) 2015 Julian Alexander Fleischer

    Permission is hereby granted, free of charge, to any
    person obtaining a copy of this software and associated
    documentation files (the "Software"), to deal in the
    Software without restriction, including without
    limitation the rights to use, copy, modify, merge,
    publish, distribute, sublicense, and/or sell copies of
    the Software, and to permit persons to whom the Software
    is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice
    shall be included in all copies or substantial portions
    of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
    ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
    TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
    PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
    DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    IN THE SOFTWARE.

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