Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-deps / dist / loop / each / baseEach.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_1 = require("../../is");
var baseForOwn_1 = require("./baseForOwn");
/**
 * The base implementation of `forEach`.
 * @since 5.0.0-beta.6
 * @memberOf loop
 *
 * @param {Array|Object} collection The collection to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @return Returns `collection`.
 *
 * @see https://github.com/lodash/lodash/blob/master/.internal/baseEach.js
 *
 */
function baseEach(collection, iteratee) {
    if (is_1.isNil(collection)) {
        console.warn('passed baseEach(null | undefined, ...)');
        // return collection
        return undefined;
    }
    else if (!is_1.isArrayLike(collection)) {
        return baseForOwn_1.default(collection, iteratee);
    }
    // @TODO toObj, length
    var length = collection.length;
    var iterable = Object(collection);
    var index = -1;
    while (++index < length) {
        // stop when they return false
        if (iteratee(iterable[index], index, iterable) === false) {
            break;
        }
    }
    return collection;
}
exports.default = baseEach;
//# sourceMappingURL=baseEach.js.map