vanillaes/absurdum

objects.forIn

jkvyff opened this issue · 1 comments

forIn iterates over own and inherited properties and invokes function on property with three arguments: (value, key, object). Returns input object.

Checklist

  • implementation
  • tests
  • jsdoc

Details

function TestObj() {
  this.a = 1;
  this.b = 2;
}
 
TestObj.prototype.c = 3;
 
objects.forIn(new TestObj(), (value, key, object) {
  console.log(key);
});
//  Logs 'a', 'b', then 'c'
> { a: 1, b: 2}

References

Added in v0.63