main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
643 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var setFunctionLength = require('set-function-length');
|
---|
| 4 |
|
---|
| 5 | var $defineProperty = require('es-define-property');
|
---|
[79a0317] | 6 |
|
---|
| 7 | var callBindBasic = require('call-bind-apply-helpers');
|
---|
| 8 | var applyBind = require('call-bind-apply-helpers/applyBind');
|
---|
[d565449] | 9 |
|
---|
| 10 | module.exports = function callBind(originalFunction) {
|
---|
[79a0317] | 11 | var func = callBindBasic(arguments);
|
---|
| 12 | var adjustedLength = originalFunction.length - (arguments.length - 1);
|
---|
[d565449] | 13 | return setFunctionLength(
|
---|
| 14 | func,
|
---|
[79a0317] | 15 | 1 + (adjustedLength > 0 ? adjustedLength : 0),
|
---|
[d565449] | 16 | true
|
---|
| 17 | );
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | if ($defineProperty) {
|
---|
| 21 | $defineProperty(module.exports, 'apply', { value: applyBind });
|
---|
| 22 | } else {
|
---|
| 23 | module.exports.apply = applyBind;
|
---|
| 24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.