3 var toPosInt = require('../../number/to-pos-integer')
4 , callable = require('../../object/valid-callable')
5 , defineLength = require('../_define-length')
7 , slice = Array.prototype.slice, apply = Function.prototype.apply
10 curry = function self(fn, length, preArgs) {
11 return defineLength(function () {
13 preArgs.concat(slice.call(arguments, 0, length - preArgs.length)) :
14 slice.call(arguments, 0, length);
15 return (args.length === length) ? apply.call(fn, this, args) :
16 self(fn, length, args);
17 }, preArgs ? (length - preArgs.length) : length);
20 module.exports = function (/*length*/) {
21 var length = arguments[0];
22 return curry(callable(this),
23 isNaN(length) ? toPosInt(this.length) : toPosInt(length));