1 | /*
|
2 | function:bind
|
3 | */"use strict"
|
4 |
|
5 | var slice = Array.prototype.slice
|
6 |
|
7 | var bind = function(self, context){
|
8 | if (arguments.length < 3) return function(){
|
9 | return self.apply(context, arguments)
|
10 | }
|
11 | var args = slice.call(arguments, 2)
|
12 | return function(){
|
13 | return self.apply(context, arguments.length ? args.concat(slice.call(arguments)): args)
|
14 | }
|
15 | }
|
16 |
|
17 | module.exports = bind
|