@@ -117,20 +117,25 @@ jStat.extend = function( obj ) {
117
117
for ( var i = 0 ; i < funcs . length ; i ++ ) ( function ( passfunc ) {
118
118
119
119
// if a matrix is passed, automatically assume operation should be done on the columns
120
- jStat . fn [ passfunc ] = function ( fullbool ) {
120
+ jStat . fn [ passfunc ] = function ( fullbool , func ) {
121
121
var arr = [ ] ,
122
122
i = 0 ,
123
- tmpthis ;
123
+ tmpthis = this ;
124
+ if ( isFunction ( fullbool ) ) {
125
+ func = fullbool ;
126
+ fullbool = false ;
127
+ }
128
+ if ( func ) {
129
+ setTimeout ( function ( ) {
130
+ func . call ( tmpthis , jStat . fn [ passfunc ] . call ( tmpthis , fullbool ) ) ;
131
+ } , 15 ) ;
132
+ return this ;
133
+ }
124
134
if ( this . length > 1 ) {
125
- tmpthis = this . transpose ( ) ;
126
- for ( ; i < tmpthis . length ; i ++ ) {
135
+ tmpthis = fullbool === true ? this : this . transpose ( ) ;
136
+ for ( ; i < tmpthis . length ; i ++ )
127
137
arr [ i ] = jStat [ passfunc ] ( tmpthis [ i ] ) ;
128
- }
129
- if ( fullbool === true ) {
130
- arr = jStat [ passfunc ] ( arr ) ;
131
- }
132
- } else {
133
- arr = jStat [ passfunc ] ( this [ 0 ] ) ;
138
+ arr = fullbool === true ? jStat [ passfunc ] ( arr ) : arr ;
134
139
}
135
140
return arr ;
136
141
} ;
@@ -140,8 +145,16 @@ jStat.extend = function( obj ) {
140
145
// extend jStat.fn with methods that have no argument
141
146
( function ( funcs ) {
142
147
for ( var i = 0 ; i < funcs . length ; i ++ ) ( function ( passfunc ) {
143
- jStat . fn [ passfunc ] = function ( ) {
144
- var results = jStat [ passfunc ] ( this ) ;
148
+ jStat . fn [ passfunc ] = function ( func ) {
149
+ var tmpthis = this ,
150
+ results ;
151
+ if ( func ) {
152
+ setTimeout ( function ( ) {
153
+ func . call ( tmpthis , jStat . fn [ passfunc ] . call ( tmpthis ) ) ;
154
+ } , 15 ) ;
155
+ return this ;
156
+ }
157
+ results = jStat [ passfunc ] ( this ) ;
145
158
return isArray ( results ) ? jStat ( results ) : results ;
146
159
} ;
147
160
} ) ( funcs [ i ] ) ;
@@ -150,7 +163,14 @@ jStat.extend = function( obj ) {
150
163
// extend jStat.fn with methods that require one argument
151
164
( function ( funcs ) {
152
165
for ( var i = 0 ; i < funcs . length ; i ++ ) ( function ( passfunc ) {
153
- jStat . fn [ passfunc ] = function ( arg ) {
166
+ jStat . fn [ passfunc ] = function ( arg , func ) {
167
+ var tmpthis = this ;
168
+ if ( func ) {
169
+ setTimeout ( function ( ) {
170
+ func . call ( tmpthis , jStat . fn [ passfunc ] . call ( tmpthis , arg ) ) ;
171
+ } , 15 ) ;
172
+ return this ;
173
+ }
154
174
return jStat ( jStat [ passfunc ] ( this , arg ) ) ;
155
175
} ;
156
176
} ) ( funcs [ i ] ) ;
0 commit comments