UNPKG

for-ease

Version:

a simple library for itrating over anything

32 lines (31 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const returnsOfCounterClass_1 = require("./../returnsOfCounterClass"); class ObjectClass { constructor(_obj) { this._obj = _obj; } getCounter() { return { do: (cb) => { let obj = this._obj; let keys = Object.keys(obj); let length = keys.length; let changedArray = []; for (var i = 0; i < length; i++) { let currentKey = keys[i]; let currentValue = obj[currentKey]; changedArray[i] = [currentKey, currentValue]; let ret = cb && cb(currentKey, currentValue); changedArray[i] = ret || changedArray[i]; } return (new returnsOfCounterClass_1.ReturnsOfCounter(changedArray)).getReturns(); } }; } setMixedObj(mixed) { this._obj = mixed; return this; } } exports.ObjectClass = ObjectClass;