# tacit

> Tacit/point-free function chains.

Latest version **0.2.1** (published 2014-10-22) · MIT license · 0 weekly downloads

## Install

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

## 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.2.1 |
| Published | 2014-10-22 |
| First published | 2014-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Christy Haragan |
| Maintainers | christyharagan |
| Keywords | functional, point-free, tacit |

## Links

- npm: https://www.npmjs.com/package/tacit
- Repository: https://github.com/christyharagan/tacit
- Issues: https://github.com/christyharagan/tacit/issues
- npm.io page: https://npm.io/package/tacit

## Recent versions

- 0.2.1 (latest) — 2014-10-22
- 0.1.0 — 2014-10-16

## README

Tacit
======

Overview
------

[Tacit/point-free](http://en.wikipedia.org/wiki/Tacit_programming) function chains. Like chains in 
[underscore](http://underscorejs.org) or [lo-dash](http://lodash.com), but with cleaner syntax. To compare:

Underscore:

```javascript
var countUnique = function(array) {
  return _.chain(array)
    .uniq()
    .size()
    .value();
}
```

Lo-dash

```javascript
var countUnique = function(array) {
  return _(array)
    .uniq()
    .size()
    .value();
}
```

Tacit:

```javascript
var countUnique = _()
  .uniq()
  .size();
```



Usage
------

Install:

```
npm install tacit
```

Basic usage:

```javascript
var tacit = require('tacit');
var _ = require('underscore');

var _t = tacit(_);

var countUnique = _t()
  .flatten()
  .uniq()
  .size();

var size = countUnique([[1,2],[2,3]]);

// prints 3
console.log(size);
```

If no functions are added to the chain, then the tacit function is just the identity function, i.e.:
 
```javascript
var _t = tacit(_);

var value = _t('Hello World');

// prints 'Hello World'
console.log(value);
```

To support arguments that aren't in the last position, either set the default position:

```javascript
var _t = tacit(_, 0);

var countUnique = _t()
  .map(String.length)
  .sortBy(Math.sin);


var sizes = countUnique(['the', 'quick', 'jumped', 'over', 'a', 'of]);

// prints [5, 4, 6, 3, 1, 2]
console.log(sizes);
```

A value of -1 for the default position means: "insert in the last position". If a value isn't specified for the default
position, -1 is assumed.

Another option is to use the special $ operator:

```javascript
var $ = tacit.$;
var _t = tacit(_);

var countUnique = _t()
  .map($, String.length)
  .sortBy($. Math.sin);
```

This overrides the default position on a function-by-function basis.

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