'use strict';

var identity$1 = require('./identity-cjs.js');
var _setToString = require('./_setToString-cjs.js');
var isTypedArray = require('./isTypedArray-cjs.js');
var isObjectLike = require('./isObjectLike-cjs.js');

var identity = identity$1.identity_1,
    overRest = _setToString._overRest,
    setToString = _setToString._setToString;

/**
 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
 *
 * @private
 * @param {Function} func The function to apply a rest parameter to.
 * @param {number} [start=func.length-1] The start position of the rest parameter.
 * @returns {Function} Returns the new function.
 */
function baseRest(func, start) {
  return setToString(overRest(func, start, identity), func + '');
}

var _baseRest = baseRest;

var eq = identity$1.eq_1,
    isArrayLike = isTypedArray.isArrayLike_1,
    isIndex = identity$1._isIndex,
    isObject = isObjectLike.isObject_1;

/**
 * Checks if the given arguments are from an iteratee call.
 *
 * @private
 * @param {*} value The potential iteratee value argument.
 * @param {*} index The potential iteratee index or key argument.
 * @param {*} object The potential iteratee object argument.
 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
 *  else `false`.
 */
function isIterateeCall(value, index, object) {
  if (!isObject(object)) {
    return false;
  }
  var type = typeof index;
  if (type == 'number'
        ? (isArrayLike(object) && isIndex(index, object.length))
        : (type == 'string' && index in object)
      ) {
    return eq(object[index], value);
  }
  return false;
}

var _isIterateeCall = isIterateeCall;

exports._baseRest = _baseRest;
exports._isIterateeCall = _isIterateeCall;
