1
- "use strict" ;
2
-
3
1
//------------------------------------------------------------------------------
4
2
// Array creation --------------------------------------------------------------
5
3
//------------------------------------------------------------------------------
6
4
7
- exports . range = function ( start ) {
5
+ export const range = function ( start ) {
8
6
return function ( end ) {
9
7
var step = start > end ? - 1 : 1 ;
10
8
var result = new Array ( step * ( end - start ) + 1 ) ;
@@ -40,9 +38,9 @@ var replicatePolyfill = function (count) {
40
38
} ;
41
39
42
40
// In browsers that have Array.prototype.fill we use it, as it's faster.
43
- exports . replicate = typeof Array . prototype . fill === "function" ? replicateFill : replicatePolyfill ;
41
+ export const replicate = typeof Array . prototype . fill === "function" ? replicateFill : replicatePolyfill ;
44
42
45
- exports . fromFoldableImpl = ( function ( ) {
43
+ export const fromFoldableImpl = ( function ( ) {
46
44
function Cons ( head , tail ) {
47
45
this . head = head ;
48
46
this . tail = tail ;
@@ -77,15 +75,15 @@ exports.fromFoldableImpl = (function () {
77
75
// Array size ------------------------------------------------------------------
78
76
//------------------------------------------------------------------------------
79
77
80
- exports . length = function ( xs ) {
78
+ export const length = function ( xs ) {
81
79
return xs . length ;
82
80
} ;
83
81
84
82
//------------------------------------------------------------------------------
85
83
// Non-indexed reads -----------------------------------------------------------
86
84
//------------------------------------------------------------------------------
87
85
88
- exports . unconsImpl = function ( empty ) {
86
+ export const unconsImpl = function ( empty ) {
89
87
return function ( next ) {
90
88
return function ( xs ) {
91
89
return xs . length === 0 ? empty ( { } ) : next ( xs [ 0 ] ) ( xs . slice ( 1 ) ) ;
@@ -97,7 +95,7 @@ exports.unconsImpl = function (empty) {
97
95
// Indexed operations ----------------------------------------------------------
98
96
//------------------------------------------------------------------------------
99
97
100
- exports . indexImpl = function ( just ) {
98
+ export const indexImpl = function ( just ) {
101
99
return function ( nothing ) {
102
100
return function ( xs ) {
103
101
return function ( i ) {
@@ -107,7 +105,7 @@ exports.indexImpl = function (just) {
107
105
} ;
108
106
} ;
109
107
110
- exports . findMapImpl = function ( nothing ) {
108
+ export const findMapImpl = function ( nothing ) {
111
109
return function ( isJust ) {
112
110
return function ( f ) {
113
111
return function ( xs ) {
@@ -121,7 +119,7 @@ exports.findMapImpl = function (nothing) {
121
119
} ;
122
120
} ;
123
121
124
- exports . findIndexImpl = function ( just ) {
122
+ export const findIndexImpl = function ( just ) {
125
123
return function ( nothing ) {
126
124
return function ( f ) {
127
125
return function ( xs ) {
@@ -134,7 +132,7 @@ exports.findIndexImpl = function (just) {
134
132
} ;
135
133
} ;
136
134
137
- exports . findLastIndexImpl = function ( just ) {
135
+ export const findLastIndexImpl = function ( just ) {
138
136
return function ( nothing ) {
139
137
return function ( f ) {
140
138
return function ( xs ) {
@@ -147,7 +145,7 @@ exports.findLastIndexImpl = function (just) {
147
145
} ;
148
146
} ;
149
147
150
- exports . _insertAt = function ( just ) {
148
+ export const _insertAt = function ( just ) {
151
149
return function ( nothing ) {
152
150
return function ( i ) {
153
151
return function ( a ) {
@@ -162,7 +160,7 @@ exports._insertAt = function (just) {
162
160
} ;
163
161
} ;
164
162
165
- exports . _deleteAt = function ( just ) {
163
+ export const _deleteAt = function ( just ) {
166
164
return function ( nothing ) {
167
165
return function ( i ) {
168
166
return function ( l ) {
@@ -175,7 +173,7 @@ exports._deleteAt = function (just) {
175
173
} ;
176
174
} ;
177
175
178
- exports . _updateAt = function ( just ) {
176
+ export const _updateAt = function ( just ) {
179
177
return function ( nothing ) {
180
178
return function ( i ) {
181
179
return function ( a ) {
@@ -194,11 +192,11 @@ exports._updateAt = function (just) {
194
192
// Transformations -------------------------------------------------------------
195
193
//------------------------------------------------------------------------------
196
194
197
- exports . reverse = function ( l ) {
195
+ export const reverse = function ( l ) {
198
196
return l . slice ( ) . reverse ( ) ;
199
197
} ;
200
198
201
- exports . concat = function ( xss ) {
199
+ export const concat = function ( xss ) {
202
200
if ( xss . length <= 10000 ) {
203
201
// This method is faster, but it crashes on big arrays.
204
202
// So we use it when can and fallback to simple variant otherwise.
@@ -215,13 +213,13 @@ exports.concat = function (xss) {
215
213
return result ;
216
214
} ;
217
215
218
- exports . filter = function ( f ) {
216
+ export const filter = function ( f ) {
219
217
return function ( xs ) {
220
218
return xs . filter ( f ) ;
221
219
} ;
222
220
} ;
223
221
224
- exports . partition = function ( f ) {
222
+ export const partition = function ( f ) {
225
223
return function ( xs ) {
226
224
var yes = [ ] ;
227
225
var no = [ ] ;
@@ -236,7 +234,7 @@ exports.partition = function (f) {
236
234
} ;
237
235
} ;
238
236
239
- exports . scanl = function ( f ) {
237
+ export const scanl = function ( f ) {
240
238
return function ( b ) {
241
239
return function ( xs ) {
242
240
var len = xs . length ;
@@ -251,7 +249,7 @@ exports.scanl = function (f) {
251
249
} ;
252
250
} ;
253
251
254
- exports . scanr = function ( f ) {
252
+ export const scanr = function ( f ) {
255
253
return function ( b ) {
256
254
return function ( xs ) {
257
255
var len = xs . length ;
@@ -270,7 +268,7 @@ exports.scanr = function (f) {
270
268
// Sorting ---------------------------------------------------------------------
271
269
//------------------------------------------------------------------------------
272
270
273
- exports . sortByImpl = ( function ( ) {
271
+ export const sortByImpl = ( function ( ) {
274
272
function mergeFromTo ( compare , fromOrdering , xs1 , xs2 , from , to ) {
275
273
var mid ;
276
274
var i ;
@@ -328,7 +326,7 @@ exports.sortByImpl = (function () {
328
326
// Subarrays -------------------------------------------------------------------
329
327
//------------------------------------------------------------------------------
330
328
331
- exports . slice = function ( s ) {
329
+ export const slice = function ( s ) {
332
330
return function ( e ) {
333
331
return function ( l ) {
334
332
return l . slice ( s , e ) ;
@@ -340,7 +338,7 @@ exports.slice = function (s) {
340
338
// Zipping ---------------------------------------------------------------------
341
339
//------------------------------------------------------------------------------
342
340
343
- exports . zipWith = function ( f ) {
341
+ export const zipWith = function ( f ) {
344
342
return function ( xs ) {
345
343
return function ( ys ) {
346
344
var l = xs . length < ys . length ? xs . length : ys . length ;
@@ -357,7 +355,7 @@ exports.zipWith = function (f) {
357
355
// Folding ---------------------------------------------------------------------
358
356
//------------------------------------------------------------------------------
359
357
360
- exports . any = function ( p ) {
358
+ export const any = function ( p ) {
361
359
return function ( xs ) {
362
360
var len = xs . length ;
363
361
for ( var i = 0 ; i < len ; i ++ ) {
@@ -367,7 +365,7 @@ exports.any = function (p) {
367
365
} ;
368
366
} ;
369
367
370
- exports . all = function ( p ) {
368
+ export const all = function ( p ) {
371
369
return function ( xs ) {
372
370
var len = xs . length ;
373
371
for ( var i = 0 ; i < len ; i ++ ) {
@@ -381,7 +379,7 @@ exports.all = function (p) {
381
379
// Partial ---------------------------------------------------------------------
382
380
//------------------------------------------------------------------------------
383
381
384
- exports . unsafeIndexImpl = function ( xs ) {
382
+ export const unsafeIndexImpl = function ( xs ) {
385
383
return function ( n ) {
386
384
return xs [ n ] ;
387
385
} ;
0 commit comments