File tree Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -18,29 +18,31 @@ exports.range = function (start) {
18
18
} ;
19
19
} ;
20
20
21
- var replicate = function ( count ) {
22
- return function ( value ) {
23
- if ( count < 1 ) {
24
- return [ ] ;
25
- }
26
- var result = new Array ( count ) ;
27
- return result . fill ( value ) ;
21
+ // In browsers that have Array.prototype.fill we use it, as it's faster.
22
+ exports . replicate = ( function ( ) {
23
+ var replicate = function ( count ) {
24
+ return function ( value ) {
25
+ if ( count < 1 ) {
26
+ return [ ] ;
27
+ }
28
+ var result = new Array ( count ) ;
29
+ return result . fill ( value ) ;
30
+ } ;
28
31
} ;
29
- } ;
30
32
31
- var replicatePolyfill = function ( count ) {
32
- return function ( value ) {
33
- var result = [ ] ;
34
- var n = 0 ;
35
- for ( var i = 0 ; i < count ; i ++ ) {
36
- result [ n ++ ] = value ;
37
- }
38
- return result ;
33
+ var replicatePolyfill = function ( count ) {
34
+ return function ( value ) {
35
+ var result = [ ] ;
36
+ var n = 0 ;
37
+ for ( var i = 0 ; i < count ; i ++ ) {
38
+ result [ n ++ ] = value ;
39
+ }
40
+ return result ;
41
+ } ;
39
42
} ;
40
- } ;
41
43
42
- // In browsers that have Array.prototype.fill we use it, as it's faster.
43
- exports . replicate = typeof Array . prototype . fill === "function" ? replicate : replicatePolyfill ;
44
+ return typeof Array . prototype . fill === "function" ? replicate : replicatePolyfill ;
45
+ } ) ( ) ;
44
46
45
47
exports . fromFoldableImpl = ( function ( ) {
46
48
function Cons ( head , tail ) {
You can’t perform that action at this time.
0 commit comments