lib/functions/dig.js
function dig(obj) {
  var iterateeFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (val, key, iterableParent) {
    return val;
  };
  // eslint-disable-line no-unused-vars
  // modifierFn = v => v,
  return (0, _each2.default)(obj, function iterator(itValue, key, itObj) {
    var processedItValue = itValue;
    // console.log("processedItValue (before)", processedItValue)
    if ((0, _is.isIterable)(itValue, { objects: true })) {
      // console.log("Is iterable, key:", key)
      processedItValue = (0, _each2.default)(itValue, iterator); // , iterateeFn
    }
    var iterateeReturnedValue = iterateeFn(processedItValue, key, itObj);
    // console.log("iterateeReturnedValue", iterateeReturnedValue)
    if ((0, _is.isObject)(iterateeReturnedValue) && (0, _is.isLength)((0, _toKeys2.default)(iterateeReturnedValue), 1) && (0, _get2.default)(iterateeReturnedValue, "$remove", false) === true) {
      return { $remove: true };
    } else if ((0, _is.isDefined)(iterateeReturnedValue)) {
      return iterateeReturnedValue;
    } else {
      // console.log("processedItValue (after)", processedItValue)
      return processedItValue;
    }
  }
  //,  iterateeFn
  );
}
function dig(obj) {
  var iterateeFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (val, key, iterableParent) {
    return val;
  };
  // eslint-disable-line no-unused-vars
  // modifierFn = v => v,
  return (0, _each2.default)(obj, function iterator(itValue, key, itObj) {
    var processedItValue = itValue;
    // console.log("processedItValue (before)", processedItValue)
    if ((0, _is.isIterable)(itValue, { objects: true })) {
      // console.log("Is iterable, key:", key)
      processedItValue = (0, _each2.default)(itValue, iterator); // , iterateeFn
    }
    var iterateeReturnedValue = iterateeFn(processedItValue, key, itObj);
    // console.log("iterateeReturnedValue", iterateeReturnedValue)
    if ((0, _is.isObject)(iterateeReturnedValue) && (0, _is.isLength)((0, _toKeys2.default)(iterateeReturnedValue), 1) && (0, _get2.default)(iterateeReturnedValue, "$remove", false) === true) {
      return { $remove: true };
    } else if ((0, _is.isDefined)(iterateeReturnedValue)) {
      return iterateeReturnedValue;
    } else {
      // console.log("processedItValue (after)", processedItValue)
      return processedItValue;
    }
  }
  //,  iterateeFn
  );
}
function dig ( obj ) { var iterateeFn = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : function ( val , key , iterableParent ) { return val ; } ; // eslint-disable-line no-unused-vars // modifierFn = v => v, return ( 0 , _each2 . default ) ( obj , function iterator ( itValue , key , itObj ) { var processedItValue = itValue ; // console.log("processedItValue (before)", processedItValue) if ( ( 0 , _is . isIterable ) ( itValue , { objects : true } ) ) { // console.log("Is iterable, key:", key) processedItValue = ( 0 , _each2 . default ) ( itValue , iterator ) ; // , iterateeFn } var iterateeReturnedValue = iterateeFn ( processedItValue , key , itObj ) ; // console.log("iterateeReturnedValue", iterateeReturnedValue) if ( ( 0 , _is . isObject ) ( iterateeReturnedValue ) && ( 0 , _is . isLength ) ( ( 0 , _toKeys2 . default ) ( iterateeReturnedValue ) , 1 ) && ( 0 , _get2 . default ) ( iterateeReturnedValue , "$remove" , false ) === true ) { return { $remove : true } ; } else if ( ( 0 , _is . isDefined ) ( iterateeReturnedValue ) ) { return iterateeReturnedValue ; } else { // console.log("processedItValue (after)", processedItValue) return processedItValue ; } } //,  iterateeFn ) ; }
Loop recursively through an iterable data structure.
@param {*} obj The value to iterate over.
@param {Function} iterateeFn The iterateeFn to look at the data.
Loop recursively through an iterable data structure .