var $        = require('./$')
  , toObject = require('./$.to-object');
module.exports = function(isEntries){
  return function(it){
    var O      = toObject(it)
      , keys   = $.getKeys(O)
      , length = keys.length
      , i      = 0
      , result = Array(length)
      , key;
    if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]];
    else while(length > i)result[i] = O[keys[i++]];
    return result;
  };
};