Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Does it quack like an array?
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
README.markdown
index.js now actually passing but deepEqual is screwy
package.json

README.markdown

quack-array

Does it quack like an array?

quack!

examples

shallow

> var quack = require('quack-array');
> quack({ 0 : 'a', 1 : 'b' })
[ 'a', 'b' ]
> quack({ 0 : 'a', 1 : 'b', x : 'c' })
{ '0': 'a', '1': 'b', x: 'c' }

deep

> var quack = require('quack-array');
> quack.deep({ 0 : { 0 : 'a', 1 : 'b' }, 1 : 'c' })
[ [ 'a', 'b' ], 'c' ]

methods

var quack = require('quack-array');

quack(obj)

If obj quacks like an array, return a new array with its elements. Otherwise return obj.

Arrays have:

  • one or more elements
  • all enumerable keys are >= 0, integers, or 'length'

quack.deep(obj)

Call quack() recursively on every element in obj.

install

With npm just do:

npm install quack-array
Something went wrong with that request. Please try again.