Preforms a binary search on a sorted Array

@method binIndex
@param  {Array} obj Array to search
@param  {Mixed} arg Value to find index of
@return {Number}    Index of `arg` within `obj`
508107
function ( obj, arg ) {
		var min = 0,
		    max = obj.length - 1,
		    idx, val;

		while ( min <= max ) {
			idx = Math.floor( ( min + max ) / 2 );
			val = obj[idx];

			if ( val < arg ) {
				min = idx + 1;
			}
			else if ( val > arg ) {
				max = idx - 1;
			}
			else {
				return idx;
			}
		}

		return -1;
	}
557397
function ( obj, arg ) {
		utility.iterate( arg, function ( v, k ) {
			if ( ( obj[k] instanceof Array ) && ( v instanceof Array ) ) {
				array.merge( obj[k], v );
			}
			else if ( ( obj[k] instanceof Object ) && ( v instanceof Object ) ) {
				utility.iterate( v, function ( x, y ) {
					obj[k][y] = utility.clone( x );
				});
			}
			else {
				obj[k] = utility.clone( v );
			}
		});

		return obj;
	}
458311
function ( arg, obj ) {
		if ( $[arg] !== undefined || !obj instanceof Object ) {
			throw new Error( label.error.invalidArguments );
		}
		
		$[arg] = obj;

		return $[arg];
	}
1183161
function sortObject(obj) {
  assert.ok(_.isObject(obj), 'Parameter should be an object! - ' + util.inspect(obj));
  assert.ok(!_.isArray(obj), 'Parameter should be an object, got array: ' + util.inspect(obj));

  var sortedKeys = _.keys(obj).sort();
  var sortedObjs = [];

  _.each(sortedKeys, function(key) {
    var val = {};
    val[key] = obj[key];
    sortedObjs.push(val);
  });

  return sortedObjs;
}
1336490
def binary_search(pVector, pElement)
      pVector.bsearch { |obj| pElement.name <=> obj.name }
    end
783662
function(arg, callback) {
    if (!arg || typeof arg !== 'object') return;

    if (arg instanceof Array) {
      arg.forEach(callback);
    } else {
      for (var k in arg) {
        callback(arg[k], k);
      }
    }
  }
322119
function(obj){
            for(var i = this.typeSortPriority.length - 1; i >= 0; i--){
                var type = this.typeSortPriority[i];
                if(obj instanceof type){
                    return i;
                }
            }
        }
168576
function binarySearch (comparator, array, key) {
  var low = 0, high = array.length - 1, partition, compare;
  while (low <= high) {
    partition = Math.floor(low + (high - low) / 2);
    compare = comparator(key, array[partition]);
    if (compare < 0) high = partition - 1;
    else if (compare > 0) low = partition + 1;
    else return partition;
  }
  return low;
}
495465
function addBinaries(binaries) {
	var SLICE = Array.prototype.slice;
	//iterate backwards to mimic normal resolution order
	for (var i = binaries.length-1; i >= 0; i--) {
		var parts = binaries[i].split('/');
		(function() {var name = parts[parts.length-1];
		exports[name] = function() {

			//grab the last argument, which might be a callback

			var cbs = SLICE.call(arguments, 3);
			//assume none of the args we got were handlers
			var args = SLICE.call(arguments);
			var argLength = args.length;
		
			var cb, stdoutHandler, stderrHandler, options;
			if (args[argLength-3] instanceof Function) {
				//we have all 3
				stderrHandler = args.pop();
				stdoutHandler = args.pop();
				cb = args.pop();
			} else if (arguments[argLength-2] instanceof Function) {
				//we have cb and stdout 
				stdoutHandler = args.pop();
				cb = args.pop();
			} else if (arguments[argLength-1] instanceof Function) {
				//we have cb only
				cb = args.pop();
			}

			//if the last arg is an object, it's the options object
			var lastArg = args[args.length-1];
			if (typeof lastArg == 'object' && !lastArg.length) {
				options = args.pop();
			}
			//if the first argument was an array, the args were passed as
			//an array
			if (args[0] instanceof Array) {
				args = args[0];
			}
			
			return runCommand(name, args, options, cb, stdoutHandler, stderrHandler);

		};})();
	}
}
1051363
function sortObj(obj) {
    return Object.keys(obj).sort()
        .filter(key => obj[key] || obj[key] === 0)
        .reduce((acc, key) => ({ ...acc, [key]: obj[key] }), {});
}
1351326
function nary(binary, args) {
		var len = args.length;
		var result = args[0];
		for (var i = 1; i < len; ++i)
			result = binary(result, args[i]);
		return result;
	}
818103
function indexById(array, id) {
    if (!array) return -1;
    return smartIndexOf(array, function (obj) {
        return obj.id === id;
    });
}
1261814
function ( obj ) {
		var nth = obj.length,
		    n   = 0,
		    mean;

		if ( nth > 0 ) {
			mean = array.mean( obj );

			array.each( obj, function ( i ) {
				n += math.sqr( i - mean );
			} );

			return n / nth;
		}
		else {
			return n;
		}
	}
1129960
function checkSort(obj) {
  var count = 0
  Object.keys(obj).forEach(key=> {
    if (obj[key] === '**String') count += 1
    if (obj[key] === '**Number') count += 1
  })
  return count <= 1
}
130233
function(index, obj) {
			var lang = this.lang;
			var lindex = index.toLowerCase();

			if(typeof obj == "object") {
				lang = obj;
			}

			if(lang && lang[lindex]) {
				return lang[lindex];
			}

			return index;
		}
1101128
function makeIndex(a, b) {
  let index = Object.create(null);

  ((a || []).concat(b ||[])).forEach(function(a) {
    index[a] = true;
  });

  return index;
}
140674
function convertToObject(args) {
	let result = {};

	args.forEach((arg, i) => {
		if (Array.isArray(arg)) {
			result[arg[0]] = arg[1];
		} else {
			if (i % 2 === 0) {
				result[arg] = undefined;
			} else {
				result[args[i - 1]] = arg;
			}
		}
	});

	return result;
}