Useful oneliners and shorthand functions
npm install 1-linersMADE IN SWITZERLAND






Functional tools that couldn’t be simpler.
We’re proud to present 1-liners – a dead simple functional utility belt. [137 one-liner functions][docs] (and counting). Each hand-crafted with love and attention.
[docs]: ./documentation
src="https://cdn.rawgit.com/1-liners/Logos/master/swissknife.gif"
width="400px"
height="300px"
/>
You get a product of top-quality functional programming craftmanship. Each function follows the KISS principle, which we’ve broken down into ten strict rules.
We always follow them. You have our word.
title="from Beautiful Flat Icons by Nick Roach"
href="https://www.elegantthemes.com/blog/freebie-of-the-week/beautiful-flat-icons-for-free"
>
alt="1-liners"
src="https://cdn.rawgit.com/1-liners/Logos/04c6949/megaphone.svg"
width="120px"
height="120px"
/>
1. Each function shall [fit in one readable line of code][]
– take a glimpse at the source and you know exactly what’s going on.
2. Each function shall [have no side-effects][]
– you can use it with confidence.
3. Each function shall [have a fixed number of arguments][]
– it’s dead easy to bind, curry and uncurry, apply partially, implode and explode.
4. Each function shall [deal with data in an immutable way][]
– no more debugging nightmares.
5. Each function shall [take data as the last argument][]
– this makes currying and composing new functions a breeze.
6. Each function shall [be in a separate micro-module][]
– you only load/bundle the single 1-liner you need.
7. Each function shall [be thoroughly tested][]
– 100% code coverage guaranteed. We even test if every function fits in one line!
8. Each function shall [have great documentation][]
– the docs explain usage, present the source, and link to the specs.
9. We shall provide functional versions of [native object methods][]
– like reduce(callback, array) for array.reduce(callback).
10. We shall provide functional versions of [language constructs][]
– like plus(a, b) for a + b.
[fit in one readable line of code]: https://github.com/1-liners/1-liners/blob/28b02d0939d6bb4034693e48440f450141453ae9/module/flip.js#L18
[have no side-effects]: ./documentation#extend
[have a fixed number of arguments]: ./documentation#shave
[deal with data in an immutable way]: ./documentation#put
[take data as the last argument]: ./documentation#split
[be in a separate micro-module]: https://github.com/1-liners/1-liners/blob/28b02d0939d6bb4034693e48440f450141453ae9/module/compose.js
[be thoroughly tested]: https://coveralls.io/r/1-liners/1-liners?branch=master
[have great documentation]: ./documentation
[native object methods]: ./documentation#reduce
[language constructs]: ./documentation#plus
```
$ npm install --save 1-liners
`js
// The lightweight, recommended way:
var map = require('1-liners/map');
// Sometimes practical:
var map = require('1-liners').map;
`
`js
// The lightweight, recommended way:
import map from '1-liners/module/map';
// Sometimes practical:
import { map, filter } from '1-liners/module';
``
Checkout the documentation
|  |  |  |
| :--:|:--:|:--: |
| stoeffel | tomekwi | hemanth |
|  |  |
| :--:|:--: |
| davidchase | tristaaan |
created with gh-contributors-table