UNPKG

for-own

Version:

Iterate over the own enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js.

20 lines (16 loc) 424 B
/*! * for-own <https://github.com/jonschlinkert/for-own> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ 'use strict'; var forIn = require('for-in'); var hasOwn = Object.prototype.hasOwnProperty; module.exports = function forOwn(obj, fn, thisArg) { forIn(obj, function(val, key) { if (hasOwn.call(obj, key)) { return fn.call(thisArg, obj[key], key, obj); } }); };