pairs source npm

_.pairs(object)

Creates an array of own enumerable key-value pairs for object.

Arguments

  1. object (Object)

    The object to query.

Returns (Array)

Returns the new array of key-value pairs.

Example

function Foo() {
  this.a = 1;
  this.b = 2;
}

Foo.prototype.c = 3;

_.pairs(new Foo);
// => [['a', 1], ['b', 2]] (iteration order is not guaranteed)