File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 50
50
51
51
Sample . whatTheFuncOut = Sample . whatTheFunc ( Sample . whatTheFuncData ) ( 'What' ) ( 'the' ) ;
52
52
53
- return context . Sample = Sample ;
53
+ Sample . add = function ( ) {
54
+ console . log ( this ) ;
55
+ var sum = 0 ;
56
+ for ( var i = 0 , len = arguments . length ; i < len ; i ++ ) {
57
+ sum += arguments [ i ] ;
58
+ }
59
+ return sum ;
60
+ } ;
54
61
55
62
var val = 2 ;
56
63
Sample . hash = { 2 : 'A' , 6 : 'B' , 9 : 'C' , '2' : 'D' } ;
57
64
Sample . hashAccess1 = { 2 : 'A' , 6 : 'B' , 9 : 'C' , '2' : 'D' } [ val ] ;
58
65
Sample . hashAccess2 = Sample . hash [ val ] ;
66
+
67
+ return context . Sample = Sample ;
59
68
} ) ( this )
69
+
70
+ Function . prototype . partial = function ( ) {
71
+ // slice is shorter and I am a lazy.
72
+ var slice = Array . prototype . slice ;
73
+ var func = this ;
74
+ var args = slice . apply ( arguments ) ;
75
+
76
+ return function ( ) {
77
+ debugger
78
+ return func . apply ( this , args . concat ( slice . apply ( arguments ) ) ) ;
79
+ } ;
80
+ } ;
You can’t perform that action at this time.
0 commit comments