Accessor that acts like either a Hash or Array accessor
765971
def [](argument)
      case argument
      when String
        target = Branch.new(@repo, argument)
        @branches.detect { |b| b == target }
      else
        @branches.__send__(:[], argument)
      end
    end
119259
def to_hash arr
      return {}   if arr.nil?
      return arr  if arr.kind_of?(Hash)
      arr = [ arr.to_sym ]  unless arr.kind_of?(Array)
      ret = {}
      arr.each { |key| ret[key.to_sym] = {} }
      ret
    end
660861
function pushArrayCache (parser, array, pos) {
  parser.arrayCache.push(array)
  parser.arrayPos.push(pos)
}
418215
function HashNode(details) {

		// If the details are not an Object
		if(!is.object(details)) {
			throw 'details must be an Object';
		}

		// If the hash config is not found
		if(!('__hash__' in details)) {
			throw 'missing "__hash__" in details';
		}

		// If there's an optional flag somewhere in the mix
		var sOptional = null;
		if('__optional__' in details) {
			sOptional = details['__optional__'];
			delete details['__optional__'];
		}

		// Store the key using the hash value
		this._key = new Node(details['__hash__']);

		// Remove it from details
		delete details['__hash__'];

		// Store the child
		this._node = child(details);

		// If we had an optional flag, add it for the parent constructor
		if(sOptional) {
			details['__optional__'] = sOptional;
		}

		// Call the parent constructor
		BasicNode.call(this, details);

		/**
		 * Clean
		 *
		 * Makes sure both the key and value are properly stored in their
		 * correct representation
		 *
		 * @name clean
		 * @access protected
		 * @param mixed value				The value to clean
		 * @return mixed
		 */
		this.clean = function clean(value) {

			// If the value is null and it's optional, return as is
			if(value == null && this._optional) {
				return null;
			}

			// If the value is not an Object
			if(!is.object(value)) {
				throw 'value must be a valid Object';
			}

			// Recurse and return it
			var oRet = {};
			for(var k in value) {
				oRet[this._key.clean(k)] = this._node.clean(value[k]);
			}
			return oRet;
		};

		/**
		 * To Object
		 *
		 * Returns the basic node as a dictionary in the same format as is used
		 * in constructing it
		 *
		 * @name toObject
		 * @access protected
		 * @return Object
		 */
		this.toObject	= function toObject() {

			// Init the object we will return
			var oRet = {};

			// Add the hash key
			oRet['__hash__'] = this._key.toObject();

			// Get the parents Object and add it to the return
			var oBasic = BasicNode.prototype.toObject.call(this);
			for(var k in oBasic) {
				oRet[k] = oBasic[k];
			}

			// Get the nodes Object and also add it to the return
			var oNode = this._node.toObject();
			for(var k in oNode) {
				oRet[k] = oNode[k];
			}

			// Return
			return oRet;
		}

		/**
		 * Type
		 *
		 * Returns the type of Node
		 *
		 * @name type
		 * @access public
		 * @return string
		 */
		this.type = function type() {
			return 'HashNode';
		}

		/**
		 * Valid
		 *
		 * Checks if a value is valid based on the instance's values
		 *
		 * @name valid
		 * @access protected
		 * @param mixed value			The value to validate
		 * @param array level			Names of parents to this node
		 * @return bool
		 */
		this.valid = function valid(value, level) {

			// Reset validation failures
			this.validation_failures = [];

			// If the value is null and it's optional. we're good
			if(value == null && this._optional) {
				return true;
			}

			// If the value isn't an Object
			if(!is.object(value)) {
				this.validation_failures.push([level.join('.'), String(value)]);
				return false;
			}

			// If level is not passed
			if(typeof level == 'undefined') {
				level = [];
			}

			// Init the return, assume valid
			var bRet = true;

			// Go through each key
			for(var k in value) {

				// Add the field to the level
				var lLevel = level.splice(0);
				lLevel.push(k);

				// If the key isn't valid
				if(!this._key.valid(String(k))) {
					this.validation_failures.push([lLevel.join('.'), 'invalid key: ' + String(k)]);
					bRet = false;
					continue;
				}

				// Check the value
				if(!this._node.valid(value[k], lLevel)) {
					this.validation_failures = this.validation_failures.concat(this._node.validation_failures.splice(0));
					bRet = false;
					continue;
				}
			}

			// Return whatever the result was
			return bRet;
		}
	}
626170
def []=(key, value)
      entry = find_entry(key)
      @dirty = true
      if entry.nil?
        @entries << [key, value]
      else
        entry[1] = value
      end
    end
602795
function( obj ) {
    var accessor = this._getAccessor( obj );
    var seen = {};
    for( var i = 0; i < this.form.elements.length; i++) {
      this.serializeField( this.form.elements[i], accessor, seen);
    }
    return accessor.target;
  }
859808
function uniqueArrayHelper (val) {
        var h = {};

        for (var i = 0, l = val.length; i < l; i++) {
            var key = JSON.stringify(val[i]);
            if (h[key]) {
                return false;
            }
            h[key] = true;
        }

        return true;
    }
635990
def method_missing(meth, *args, &block)
      if meth.to_s =~ /=$/
        self.define_accessors(meth.to_s.gsub(/=$/,''))
        return self.send(meth, *args, &block)
      end
      super
    end
242858
function isArray(obj) {
		var type = sType(obj);
		return (Array.isArray(obj) || (typeof(type) === 'string' && type.substring(0, 5) === 'Array'));
	}
848654
function accessor(object) {
    var ref = object || (1, eval)('this');
    var len = parts.length;
    var idx = 0;

    // iteratively save each segment's reference
    for (; idx < len; idx += 1) {
      if (ref) ref = ref[parts[idx]];
    }

    return ref;
  }
1096141
def accessors(options = {})
      headers = extract_headers!(options)
      json = client.list("/v1/auth/token/accessors", options, headers)
      return Secret.decode(json)
    end
437315
function hash_serializer(result, key, value) {
  var matches = key.match(brackets);

  // Has brackets? Use the recursive assignment function to walk the keys,
  // construct any missing objects in the result tree and make the assignment
  // at the end of the chain.
  if (matches) {
    var keys = parse_keys(key);
    hash_assign(result, keys, value);
  }
  else {
    // Non bracket notation can make assignments directly.
    var existing = result[key];

    // If the value has been assigned already (for instance when a radio and
    // a checkbox have the same name attribute) convert the previous value
    // into an array before pushing into it.
    //
    // NOTE: If this requirement were removed all hash creation and
    // assignment could go through `hash_assign`.
    if (existing) {
      if (!Array.isArray(existing)) {
        result[key] = [ existing ];
      }

      result[key].push(value);
    }
    else {
      result[key] = value;
    }
  }

  return result;
}
386170
function isArray(val) {
    /* istanbul ignore if */
    if (!Array.isArray)
        return constant_1.toStr.call(val) === '[object Array]';
    return Array.isArray(val);
}
334247
def accessor(self):
        
        if isinstance(self.attr, Accessor):
            return self.attr

        if callable(self.attr):
            return Accessor(getter=self.attr)

        attr = self.attr or self.name
        return Accessor(getter=attr, setter=attr)
1223203
function isArray(value) {
  return toFunctionCall(
    t.memberExpression(
      t.identifier("Array"),
      t.identifier("isArray")
    ),
    [value]
  );
}
592918
function parseArray (parser) {
  const length = parseLength(parser)
  if (length === undefined) {
    return
  }
  if (length < 0) {
    return null
  }
  const responses = new Array(length)
  return parseArrayElements(parser, responses, 0)
}
1286570
function parseArrayElements (parser, responses, i) {
  const bufferLength = parser.buffer.length
  while (i < responses.length) {
    const offset = parser.offset
    if (parser.offset >= bufferLength) {
      pushArrayCache(parser, responses, i)
      return
    }
    const response = parseType(parser, parser.buffer[parser.offset++])
    if (response === undefined) {
      if (!(parser.arrayCache.length || parser.bufferCache.length)) {
        parser.offset = offset
      }
      pushArrayCache(parser, responses, i)
      return
    }
    responses[i] = response
    i++
  }

  return responses
}