@amphibian/for-own

1.0.14 • Public • Published

for-own

build status

for...in abstraction to iterate over an objects own keys

npm install @amphibian/for-own
var forOwn = require('@amphibian/for-own');
var object = {
    foo: 'bar',
    bar: 'foo'
};

// Iterate over object keys and values
forOwn(object, function (key, value) {
    console.log(key, value);
});

// Iterate over object keys, but stop if the key is `foo`
var question = forOwn(object, function (key, value, end) {
    console.log(key, value);

    if (key === 'foo') {
        end('hola que hora es');
    }
});

console.log(question); // > hola que hora es

Readme

Keywords

none

Package Sidebar

Install

npm i @amphibian/for-own

Weekly Downloads

4

Version

1.0.14

License

ISC

Last publish

Collaborators

  • thomaslindstr_m