set prop k to v - convert to array and push if obj[k] exists
19098
function setaVal(obj, k, v) {
  if (obj.hasOwnProperty(k)) {
    var val = obj[k];
    if (!_.isArray(val)) { obj[k] = [val]; }
    obj[k].push(v);
  }
  else { obj[k] = v; }
}
1259243
function ( obj, target ) {
            var result = [];
            for ( var n in obj ) {
                result.push( target === 'key' ? n : obj[n] );
            }
    
            return result;
        }
644413
function keysInObject(obj, keys) {
  for (var i in keys) {
    if (keys[i] in obj) return true;
  }
  return false;
}
1269967
public static function prop_or_arr($obj, $key) {
        if (is_object($obj) && array_key_exists($key, get_object_vars($obj))) {
            return $obj->$key;
        }

        if (is_array($obj) && isset($obj[$key])) {
            return $obj[$key];
        }

        return false;
      }
489514
function getOrSetProp(obj, prop, value) {
    if (!isObject(obj)) return;
    if (!(0, _is.isString)(prop)) return;

    var props = prop.split('.');

    if (props.length === 1) {
        if (arguments.length === 2) {
            return obj[props[0]];
        } else {
            return obj[props[0]] = value;
        }
    }

    var target = obj[props[0]];

    for (var i = 1; i < props.length - 1; i++) {
        target = target[props[i]];
    }

    if (arguments.length === 2) {
        return target[(0, _array.lastOneOf)(props)];
    } else {
        return target[(0, _array.lastOneOf)(props)] = value;
    }
}
134743
function each (obj, fn) {
      var key;
      for (key in obj) {
        if (Object.hasOwnProperty.call(obj, key)) {
          fn(key);
        }
      }
    }
538560
function (o) {
        var r = [];
        for (var i in o) {
          if (o.hasOwnProperty(i)) {
            r.push(i);
          }
        }
        return r;
      }
1254982
function(obj, callback) {
		var length, key, i, undef;

		if (obj) {
			try {
				length = obj.length;
			} catch(ex) {
				length = undef;
			}

			if (length === undef) {
				// Loop object items
				for (key in obj) {
					if (obj.hasOwnProperty(key)) {
						if (callback(obj[key], key) === false) {
							return;
						}
					}
				}
			} else {
				// Loop array items
				for (i = 0; i < length; i++) {
					if (callback(obj[i], i) === false) {
						return;
					}
				}
			}
		}
	}
1360371
function set(obj, key, val) {
  var v = obj[key];
  if (hasOwnProperty.call(Object.prototype, key)) return;
  if (undefined === v) {
    obj[key] = val;
  } else if (isArray(v)) {
    v.push(val);
  } else {
    obj[key] = [v, val];
  }
}
215628
function (prop) {
      var keys = Object.keys(this.keyMap);
      var items = this.items.map(function (item, i) {
        item.key = keys[i];
        return item;
      });
      var sorted = lazy.arraySort(items, prop);
      this.items = sorted;
      this.keyMap = this.items.reduce(function (acc, item, i) {
        acc[item.key] = i;
        return acc;
      }, {});
      return this;
    }
514887
function (obj, pred) {
      var props = keys(obj);
      for (var k = 0, len = props.length; k < len; k++) {
        var i = props[k];
        var x = obj[i];
        if (pred(x, i, obj)) {
          return Option.some(x);
        }
      }
      return Option.none();
    }
1337591
function compact(obj) {
  if ('object' != typeof obj) return obj;

  if (isArray(obj)) {
    var ret = [];

    for (var i in obj) {
      if (hasOwnProperty.call(obj, i)) {
        ret.push(obj[i]);
      }
    }

    return ret;
  }

  for (var key in obj) {
    obj[key] = compact(obj[key]);
  }

  return obj;
}
636352
function pushEncodedKeyValuePair(pairs, key, val) {
  if (val != null) {
    if (Array.isArray(val)) {
      val.forEach(function(v) {
        pushEncodedKeyValuePair(pairs, key, v);
      });
    } else if (isObject(val)) {
      for(var subkey in val) {
        pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);
      }
    } else {
      pairs.push(encodeURIComponent(key)
        + '=' + encodeURIComponent(val));
    }
  } else if (val === null) {
    pairs.push(encodeURIComponent(key));
  }
}
617769
function set(from, to) {
    for (var key in to) {
        if (!from.hasOwnProperty(key)) {
            continue;
        }

        var value = from[key];

        if (value instanceof Array) {
            to[key] = [].concat(value);
        } else {
            to[key] = value;
        }
    }

    return to;
}
1313555
function add (obj, name, value) {
  const previous = obj[name]
  if (previous) {
    const arr = [].concat(previous)
    arr.push(value)
    return arr
  } else return value
}
785263
function kv(obj) {
  return traverse(obj).reduce(function(acc, v) {
    if (this.isLeaf) {
      if (!Array.isArray(v) && !isObject(v)) { // ignore empty array and object
        var path = pointer.compile(this.path);
        acc[path] = v;
      }
    }

    return acc;
  }, {});
}
1304990
function toArray(obj) {
	if (Array.isArray(obj)) return obj;
	var a = [];
	a.push(obj);
	return a;
}