<commit_before>
/**
 * Module dependencies.
 * @api private
 */

var index = require('indexof');


/**
 * wedge constructor.
 * @api public
 */

module.exports = function wedge(obj) {
	var args = [].slice.call(arguments, 1);
	if(obj instanceof Array) {
		return array(obj, args);
	} else {
		return object(obj, args);
	}
};

function object(obj, args) {
	var result = {};
	for(var i = 0, l = args.length; i < l; i++) {
		var key = args[i];
		result[key] = obj[key]; 
	}
	return result;
}


function array(obj, args) {
	var result = [];
	for(var i = 0, l = obj.length; i < l; i++) {
		if(index(args, i) > -1) result.push(obj[i]);
	}
	return result;
}<commit_msg>add doc<commit_after>
/**
 * Module dependencies.
 * @api private
 */

var index = require('indexof');


/**
 * wedge constructor.
 * 
 * @api public
 */

module.exports = function wedge(obj) {
  var args = [].slice.call(arguments, 1);
  if(obj instanceof Array) {
    return array(obj, args);
  }
  return object(obj, args);
};


/**
 * wedge objects.
 *
 * Slice keys from object and return a new 
 * object with just these keys.
 *
 * Examples:
 *
 *   wedge({
 *     video: true,
 *     audio: false,
 *     right: 'admin'
 *   }, 'video', 'right');
 *   // => { video: true, right: 'admin'}
 *   
 * @param  {Object} obj 
 * @return {Object}
 */

function object(obj, args) {
  var result = {};
  for(var i = 0, l = args.length; i < l; i++) {
    var key = args[i];
    result[key] = obj[key];
  }
  return result;
}


/**
 * wedge arrays.
 *
 * Slice items from array and return a new 
 * array with just these items.
 *
 * Examples:
 *
 *   wedge(['olivier', {
 *     video: true
 *   }, 'bredele'], 0, 2);
 *   // => [{video:true}, 'bredele']
 *   
 * @param  {Array} obj 
 * @return {Array}
 */

function array(obj, args) {
  var result = [];
  for(var i = 0, l = obj.length; i < l; i++) {
    if(index(args, i) > -1) result.push(obj[i]);
  }
  return result;
}
{'fraction_non_alphanumeric': 0.18953909891248058, 'fraction_numerical': 0.005178663904712584, 'mean_word_length': 2.722543352601156, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5717800', 'n_tokens_mistral': 741, 'n_tokens_neox': 705, 'n_words': 199}