File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 23062306 } ,
23072307
23082308 isPrime : function ( n ) {
2309- if ( n <= 0 || NumberUtil . isFloat ( n ) ) {
2309+ if ( typeof n !== 'number' || Number . isNaN ( n ) || NumberUtil . isFloat ( n ) ) {
23102310 return false ;
23112311 }
2312- if ( n == = 1 ) {
2312+ if ( n < = 1 ) {
23132313 return false ;
2314- } else if ( n === 2 ) {
2314+ }
2315+ if ( n <= 3 ) {
23152316 return true ;
2316- } else if ( n % 2 === 0 ) {
2317+ }
2318+ if ( n % 2 === 0 || n % 3 === 0 ) {
23172319 return false ;
23182320 }
2319- for ( var i = 3 ; i * i <= n ; i += 2 ) {
2320- if ( n % i === 0 ) {
2321+ for ( var i = 5 ; i * i <= n ; i += 6 ) {
2322+ if ( n % i === 0 || n % ( i + 2 ) === 0 ) {
23212323 return false ;
23222324 }
23232325 }
36733675 xml : XMLUtil ,
36743676 url : URLUtil ,
36753677 utf8 : UTF8Util ,
3676- version : '0.23.2 ' ,
3678+ version : '0.24.1 ' ,
36773679 } ;
36783680
36793681 return utils ;
Original file line number Diff line number Diff line change 15421542 return n >= 0 ;
15431543 } ,
15441544 isPrime : function ( n ) {
1545- if ( n <= 0 || p . isFloat ( n ) ) return ! 1 ;
1546- if ( 1 === n ) return ! 1 ;
1547- if ( 2 === n ) return ! 0 ;
1548- if ( n % 2 == 0 ) return ! 1 ;
1549- for ( var t = 3 ; t * t <= n ; t += 2 ) if ( n % t == 0 ) return ! 1 ;
1545+ if ( 'number' != typeof n || Number . isNaN ( n ) || p . isFloat ( n ) ) return ! 1 ;
1546+ if ( n <= 1 ) return ! 1 ;
1547+ if ( n <= 3 ) return ! 0 ;
1548+ if ( n % 2 == 0 || n % 3 == 0 ) return ! 1 ;
1549+ for ( var t = 5 ; t * t <= n ; t += 6 )
1550+ if ( n % t == 0 || n % ( t + 2 ) == 0 ) return ! 1 ;
15501551 return ! 0 ;
15511552 } ,
15521553 } ) ,
26372638 return unescape ( encodeURIComponent ( n ) ) ;
26382639 } ,
26392640 } ) ,
2640- version : '0.23.2 ' ,
2641+ version : '0.24.1 ' ,
26412642 }
26422643 ) ;
26432644} ) ;
You can’t perform that action at this time.
0 commit comments