Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

dent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dent

The closest you can get to DEstructuring assignmeNT with good old ES5's objects and functions

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

dent Dependency Status DevDependency Status

npm

The closest you can get to DEstructuring assignmeNT with good old ES5's objects and functions.

Example

dent for arrays:

> var tuple = ['first', 'second', 'third']

> dent(tuple)
> var a = dent() // Or in a single statement: dent(tuple)()
> var b = dent()
> var c = dent()

> dent.idx
3 // Next element's index.

> [a, b, c]
[ 'first', 'second', 'third' ]

dent for objects:

> var pair = { first: 'foo', second: 'bar' }

> dent(pair)
> var a = dent.o.first // Or in a single statement: dent(pair).o.first
> var b = dent.o.second

> [a, b]
[ 'foo', 'bar' ]

API

dent(obj)

Save reference to obj in dent.o. Return the dent itself.

dent.o

Object passed to dent the last time.

dent()

Return the next element (with index dent.idx) and increment dent.idx by 1.

dent.idx

Next element's index (as would be accessed by dent()).

Warning

dent storage is temporary. Drop your object in, take it apart, but don't assume that it will sit in dent.o or dent.idx will be the same next time you check.

Install

npm install dent

License

MIT

Keywords

destructive

FAQs

Package last updated on 10 Nov 2014

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