New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

drier

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drier

eliminate repetition or stutter in assignments

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

David

Drier

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

Is DRY (Don't Repeat Yourself) 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?

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!

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

...and through the magic of destructuring and proxies, 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

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

Keywords

FAQs

Package last updated on 21 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc