Constructs nested object reflecting array
@returns {object} The nested object
@param {array} arr - array from which to construct object
@param {any} val - value to assign to the deepest level object key
499157
function (arr, val) {
    if (!arr || arr.length === 0) return {}

    let o = {}
    let v = val || null

    if (arr.length > 1)
      v = this.fromArray(arr.slice(1), v)

    o[arr[0]] = v
    return o
  }
386170
function isArray(val) {
    /* istanbul ignore if */
    if (!Array.isArray)
        return constant_1.toStr.call(val) === '[object Array]';
    return Array.isArray(val);
}
805949
function arrayToList ( arr ) {
	const length = arr.length;
	const data = new types.List(length);
	for ( let i = 0; i < length; i++ ) {
		data.setValue(i, setJsonValueToSassValue(arr[i]));
	}
	return data;
}
519928
def cast(parent, value)
      return value unless casted
      if type.is_a?(Array)
        # Convert to array if it is not already
        value = [value].compact unless value.is_a?(Array)
        arr = value.collect { |data| cast_value(parent, data) }
        # allow casted_by calls to be passed up chain by wrapping in CastedArray
        value = type_class != String ? ::CouchRest::CastedArray.new(arr, self) : arr
        value.casted_by = parent if value.respond_to?(:casted_by)
      elsif !value.nil?
        value = cast_value(parent, value)
      end
      value
    end
676531
function (str) {
        var arr = str.split('.');
        var obj = root[arr.shift()];

        while (arr.length && obj) {
            obj = obj[arr.shift()];
        }
        return obj;
    }
544460
function ensureAnArray (arr) {
        if (Object.prototype.toString.call(arr) === '[object Array]') {
            return arr;
        } else if (arr === null || arr === void 0) {
            return [];
        } else {
            return [arr];
        }
    }
569940
function(rawObj, arrayInst){
                // create an instance
                var inst = rawObj.constructor === Model ?
                    rawObj : new Model(rawObj);

                // set a pointer to the array
                inst.$$array = arrayInst;

                return inst;
            }
1171966
function flatten( arr ) {
	var tmp;
	var out;
	var i;
	var j;
	
	out = [];
	for ( i = 0; i < arr.length; i++ ) {
		tmp = arr[ i ];
		if ( tmp ) {
			for ( j = 0; j < tmp.length; j++ ) {
				out.push( tmp[ j ] );
			}
		}
	}
	return out;
}
339659
function create( arr ) {
	var f = '';
	f += 'return function fill( len ) {';
	f += 'var arr = new Array( len );';
	f += 'for ( var i = 0; i < len; i++ ) {';
	f += 'arr[ i ] = ' + serialize( arr ) + ';';
	f += '}';
	f += 'return arr;';
	f += '}';
	return ( new Function( f ) )();
}
1295800
function(val) {
      switch (typeof val) {
        case 'undefined':
        case 'boolean':
        case 'number':
        case 'string':
        case 'symbol':
        case 'function':
          return val;
        case 'object':
        default: {
          // typeof null === 'object'
          if (!val) return val;

          // This covers Uint8Array and friends, even without a TypedArray
          // base-class constructor.
          const isTypedArray =
              val.buffer && val.buffer.constructor == ArrayBuffer;
          if (isTypedArray) {
            return val;
          }

          if (seenObjects.has(val)) {
            return null;
          }

          const isArray = val.constructor == Array;
          if (val.constructor != Object && !isArray) {
            return null;
          }

          seenObjects.add(val);
          const ret = isArray ? [] : {};
          // Note |name| will equal a number for arrays.
          for (const name in val) {
            ret[name] = clone(val[name]);
          }

          // Length is a non-enumerable property, but we should copy it over in
          // case it is not the default.
          if (isArray) {
            ret.length = val.length;
          }
          return ret;
        }
      }
    }
1350625
function toSet(arr) {
  const set = {};
  arr.forEach((e) => (set[e] = true));
  return set;
}
1354500
function (val) {
			if (val === undefined || val === null) return;
			if (val instanceof Array) return this.cacheArray(val);
			if (typeof val == 'object' && val.constructor == Object) return this.cacheObject(val);

			if (!(val instanceof shine.Table) || val.__shine.refCount === undefined) return;

			var i, l, 
				meta = val.__shine;

			for (i = 0, l = meta.keys.length; i < l; i++) this.decrRef(meta.keys[i]);
			for (i = 0, l = meta.values.length; i < l; i++) this.decrRef(meta.values[i]);
			for (i = 0, l = meta.numValues.length; i < l; i++) this.decrRef(meta.numValues[i]);

			this.cacheArray(meta.keys);
			this.cacheArray(meta.values);

			delete meta.keys;
			delete meta.values;

			this.cacheObject(meta);
			delete val.__shine;

			for (i in val) if (val.hasOwnProperty(i)) this.decrRef(val[i]);
		}
72580
function(arr) {
        if (Array.prototype.from) return Array.from(new Set(arr));
        return arr.filter(function(v,i,a) {
          return i === a.indexOf(v);
        });
      }
258024
function mergeOne(dst, src) {
  if (src === undefined) return dst;

  // According to specification arrays must be concatenated.
  // Also, the '.concat' creates a new array instance. Overrides the 'dst'.
  if (isArray(src)) return (isArray(dst) ? dst : []).concat(src);

  // Now deal with non plain 'src' object. 'src' overrides 'dst'
  // Note that functions are also assigned! We do not deep merge functions.
  if (!isPlainObject(src)) return src;

  // See if 'dst' is allowed to be mutated.
  // If not - it's overridden with a new plain object.
  var returnValue = isObject(dst) ? dst : {};

  var keys = Object.keys(src);
  for (var i = 0; i < keys.length; i += 1) {
    var key = keys[i];

    var srcValue = src[key];
    // Do not merge properties with the 'undefined' value.
    if (srcValue !== undefined) {
      var dstValue = returnValue[key];
      // Recursive calls to mergeOne() must allow only plain objects or arrays in dst
      var newDst = isPlainObject(dstValue) || isArray(srcValue) ? dstValue : {};

      // deep merge each property. Recursion!
      returnValue[key] = mergeOne(newDst, srcValue);
    }
  }

  return returnValue;
}
153151
function deepClone(val, instanceClone) {
        switch ( kindOf(val) ) {
            case 'Object':
                return cloneObject(val, instanceClone);
            case 'Array':
                return cloneArray(val, instanceClone);
            default:
                return clone(val);
        }
    }
1029903
public static Object growArrayToAtLeast(Object arr, int minLen)
    {
        if (arr == null) {
            throw new IllegalArgumentException(NO_TYPE);
        }
        Object old = arr;
        int oldLen = Array.getLength(arr);
        int newLen = oldLen + ((oldLen + 1) >> 1);
        if (newLen < minLen) {
            newLen = minLen;
        }
        arr = Array.newInstance(arr.getClass().getComponentType(), newLen);
        System.arraycopy(old, 0, arr, 0, oldLen);
        return arr;
    }
1160798
function orderBy (arr) {
  var comparator = null
  var sortKeys
  arr = util.convertArray(arr)

  // determine order (last argument)
  var args = util.toArray(arguments, 1)
  var order = args[args.length - 1]
  if (typeof order === 'number') {
    order = order < 0 ? -1 : 1
    args = args.length > 1 ? args.slice(0, -1) : args
  } else {
    order = 1
  }

  // determine sortKeys & comparator
  var firstArg = args[0]
  if (!firstArg) {
    return arr
  } else if (typeof firstArg === 'function') {
    // custom comparator
    comparator = function (a, b) {
      return firstArg(a, b) * order
    }
  } else {
    // string keys. flatten first
    sortKeys = Array.prototype.concat.apply([], args)
    comparator = function (a, b, i) {
      i = i || 0
      return i >= sortKeys.length - 1
        ? baseCompare(a, b, i)
        : baseCompare(a, b, i) || comparator(a, b, i + 1)
    }
  }

  function baseCompare (a, b, sortKeyIndex) {
    var sortKey = sortKeys[sortKeyIndex]
    if (sortKey) {
      if (sortKey !== '$key') {
        if (util.isObject(a) && '$value' in a) a = a.$value
        if (util.isObject(b) && '$value' in b) b = b.$value
      }
      a = util.isObject(a) ? util.getPath(a, sortKey) : a
      b = util.isObject(b) ? util.getPath(b, sortKey) : b
    }
    return a === b ? 0 : a > b ? order : -order
  }

  // sort on a copy to avoid mutating original array
  return arr.slice().sort(comparator)
}