import { _u } from './_u';
export const each = (target, action = (...args) => { }) => {
    let i = 0;
    let index = 0;
    let key;
    if (typeof target === 'number') {
        for (i = 0; i < target; i += 1) {
            action(i, i / (target - 1));
        }
    }
    else if (Array.isArray(target)) {
        const len = target.length;
        for (i = 0; i < len; i += 1) {
            action(target[i], i, i / (target.length - 1));
        }
    }
    else {
        let size = _u.size(target) - 1;
        if (typeof target !== 'string') {
            for (key in target) {
                if (typeof target[key] !== 'undefined') {
                    action(target[key], key, index, i / size);
                    index++;
                }
            }
        }
    }
};
//# sourceMappingURL=each.js.map