# drier

> eliminate repetition or stutter in assignments

Latest version **1.0.3** (published 2017-11-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2017-11-21 |
| First published | 2017-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jnvm |
| Maintainers | jnvm |
| Keywords | dry, don't, repeat, yourself, dryness, stutter, code, style, proxy, destructure, destructuring, terse, brief, simplify |

## Links

- npm: https://www.npmjs.com/package/drier
- Repository: https://github.com/jnvm/drier
- Homepage: https://github.com/jnvm/drier#readme
- Issues: https://github.com/jnvm/drier/issues
- npm.io page: https://npm.io/package/drier

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2017-11-21
- 1.0.2 — 2017-11-21
- 1.0.1 — 2017-11-21
- 1.0.0 — 2017-11-21

## README

[![](https://img.shields.io/badge/SLOC-1-brightgreen.svg)](https://github.com/jnvm/drier/blob/master/drier.js#L1)
[![David](https://img.shields.io/david/jnvm/drier.svg?maxAge=360000)]()
# Drier

Does repetition in code bother you to what others call an unreasonable degree?

Is DRY (**D**on't **R**epeat **Y**ourself) such a governing rule when you write code that you regularly apply it to real life scenarios?

Do blocks of code with even this level of repetition offend you at a visceral level?

```javascript
let thing = operator('thing')
let aThing = operator('aThing')
let thisThing = operator('thisThing')
let thatThing = operator('thatThing')
let theOtherThing = operator('theOtherThing')
```

Be offended no more: just make it `drier`!

```javascript
let {thing, aThing, thisThing,
	thatThing, theOtherThing} = require('drier')(operator)
```

...and through the magic of [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) and [proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/get), never stutter variables in code again!

## How It Works

`drier` is a function which invokes its input function with a string of each variable name on the left of the destructuring assignment,
removing the need to repeat them, and maybe encouraging more meaningful names.

Or you could describe it as an iterator across variable names.

## More Examples
```javascript
const drier = require('./drier.js')
const dryquire = drier(require)
const {fs, crypto, util, http, os, repl, express, "package.json":{scripts}} = dryquire
const {sqlA, sqlB, sqlC, sqlD} = drier(s => fs.readFileSync(`${__dirname}/${s}.sql`))
```
----
#### see also
* [dryer vs drier](https://writingexplained.org/drier-vs-dryer-difference)
* [`new Proxy()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)

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