mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-23 22:13:48 +01:00
34 lines
818 B
JavaScript
34 lines
818 B
JavaScript
|
/* */
|
||
|
'use strict';
|
||
|
var $ = require("./$"),
|
||
|
invoke = require("./$.invoke"),
|
||
|
assertFunction = require("./$.assert").fn;
|
||
|
module.exports = function() {
|
||
|
var fn = assertFunction(this),
|
||
|
length = arguments.length,
|
||
|
pargs = Array(length),
|
||
|
i = 0,
|
||
|
_ = $.path._,
|
||
|
holder = false;
|
||
|
while (length > i)
|
||
|
if ((pargs[i] = arguments[i++]) === _)
|
||
|
holder = true;
|
||
|
return function() {
|
||
|
var that = this,
|
||
|
_length = arguments.length,
|
||
|
j = 0,
|
||
|
k = 0,
|
||
|
args;
|
||
|
if (!holder && !_length)
|
||
|
return invoke(fn, pargs, that);
|
||
|
args = pargs.slice();
|
||
|
if (holder)
|
||
|
for (; length > j; j++)
|
||
|
if (args[j] === _)
|
||
|
args[j] = arguments[k++];
|
||
|
while (_length > k)
|
||
|
args.push(arguments[k++]);
|
||
|
return invoke(fn, args, that);
|
||
|
};
|
||
|
};
|