diff --git a/src/base/StopIteration.js b/src/base/StopIteration.js
index bc3f4f9..d6c71c9 100644
--- a/src/base/StopIteration.js
+++ b/src/base/StopIteration.js
@@ -2,4 +2,4 @@
* Error thrown by {@link next} when the input iterator is exhausted.
* @class
*/
-export {StopIteration} from '@aureooms/js-error';
+export {StopIteration as default} from '@aureooms/js-error';
diff --git a/src/base/_count.js b/src/base/_count.js
index e622bc7..bc74fa4 100644
--- a/src/base/_count.js
+++ b/src/base/_count.js
@@ -12,9 +12,9 @@
*
* @param {Number} start - The starting value.
* @param {Number} step - The step between the values.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* _count(start, step) {
+export default function* _count(start, step) {
while (true) {
yield start;
diff --git a/src/base/_drop.js b/src/base/_drop.js
new file mode 100644
index 0000000..1df0bde
--- /dev/null
+++ b/src/base/_drop.js
@@ -0,0 +1,21 @@
+import assert from 'assert';
+import iter from './iter.js';
+import consume from './consume.js';
+
+/**
+ * Drops the first n
values of the input iterable.
+ *
+ * @example
+ * // returns [ 3 , 4 ]
+ * list( _drop( range( 5 ) , 3 ) ) ;
+ *
+ * @param {Iterable} iterable - The input iterable.
+ * @param {Number} n - The nonnegative number of values to drop.
+ * @returns {IterableIterator} - The remaining values of the input iterable.
+ */
+export default function* _drop(iterable, n) {
+ assert(Number.isInteger(n) && n >= 0);
+ const iterator = iter(iterable);
+ consume(iterator, n);
+ yield* iterator;
+}
diff --git a/src/base/_next.js b/src/base/_next.js
index 8463274..0333ad1 100644
--- a/src/base/_next.js
+++ b/src/base/_next.js
@@ -4,6 +4,6 @@
* @param {Iterator} iterator - The input iterator.
* @returns {{done: Boolean, value: Object}}
*/
-export function _next(iterator) {
+export default function _next(iterator) {
return iterator.next();
}
diff --git a/src/base/_range.js b/src/base/_range.js
index 36c9136..c938031 100644
--- a/src/base/_range.js
+++ b/src/base/_range.js
@@ -6,9 +6,9 @@
* @param {Number} start - The starting value.
* @param {Number} stop - The stopping value.
* @param {Number} step - The step value.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* _range(start, stop, step) {
+export default function* _range(start, stop, step) {
if (step < 0) {
for (; start > stop; start += step) {
yield start;
diff --git a/src/base/_tail.js b/src/base/_tail.js
new file mode 100644
index 0000000..0d7217a
--- /dev/null
+++ b/src/base/_tail.js
@@ -0,0 +1,18 @@
+import assert from 'assert';
+import deque from '@aureooms/js-collections-deque';
+
+/**
+ * Returns the last n
values of the input iterable in an array.
+ *
+ * @example
+ * // returns [ 3 , 4 ]
+ * list( _tail( range( 5 ) , 2 ) ) ;
+ *
+ * @param {Iterable} iterable - The input iterable.
+ * @param {Number} n - The nonnegative number of values to include in the output.
+ * @returns {IterableIterator} - The last n
values of the input iterable.
+ */
+export default function* _tail(iterable, n) {
+ assert(Number.isInteger(n) && n >= 0);
+ yield* deque(iterable, n);
+}
diff --git a/src/base/_take.js b/src/base/_take.js
new file mode 100644
index 0000000..462a54f
--- /dev/null
+++ b/src/base/_take.js
@@ -0,0 +1,29 @@
+import assert from 'assert';
+import iter from './iter.js';
+
+/**
+ * Yields the first n
elements of the input iterable.
+ *
+ * @example
+ * // returns [ 0 , 1 , 2 ]
+ * list( _take( range( 5 ) , 3 ) ) ;
+ *
+ * @param {Iterable} iterable - The input iterable.
+ * @param {Number} n - The nonnegative number of elements to include in the output.
+ * @returns {IterableIterator} - The first n
elements of the input iterable.
+ */
+export default function* _take(iterable, n) {
+ assert(Number.isInteger(n) && n >= 0);
+
+ const iterator = iter(iterable);
+
+ while (n-- > 0) {
+ const current = iterator.next();
+
+ if (current.done) {
+ return;
+ }
+
+ yield current.value;
+ }
+}
diff --git a/src/base/_trunc.js b/src/base/_trunc.js
new file mode 100644
index 0000000..7a15afc
--- /dev/null
+++ b/src/base/_trunc.js
@@ -0,0 +1,42 @@
+import assert from 'assert';
+import deque from '@aureooms/js-collections-deque';
+
+import iter from './iter.js';
+
+/**
+ * Yields all elements of the iterable except the last n
ones.
+ *
+ * @example
+ * // returns [ 0 , 1 , 2 ]
+ * list( _trunc( range( 5 ) , 2 ) ) ;
+ *
+ * @param {Iterable} iterable - The input iterable.
+ * @param {Number} n - The nonnegative number of elements to exclude from the output.
+ * @returns {IterableIterator}
+ */
+export default function* _trunc(iterable, n) {
+ assert(Number.isInteger(n) && n >= 0);
+
+ if (n === 0) {
+ yield* iterable;
+ return;
+ }
+
+ const iterator = iter(iterable);
+
+ const buffer = deque(null, n);
+
+ while (n-- > 0) {
+ const event = iterator.next();
+ if (event.done) {
+ return;
+ }
+
+ buffer.append(event.value);
+ }
+
+ for (const value of iterator) {
+ yield buffer.popleft();
+ buffer.append(value);
+ }
+}
diff --git a/src/base/by.js b/src/base/by.js
index ba42535..f49dc36 100644
--- a/src/base/by.js
+++ b/src/base/by.js
@@ -1,5 +1,5 @@
-import {iter} from './iter.js';
-import {range} from './range.js';
+import iter from './iter.js';
+import range from './range.js';
/**
* Yields elements of the input iterable by grouping them into tuples of a
@@ -9,7 +9,7 @@ import {range} from './range.js';
* @param {Number} n - The size of the yielded tuples.
* @returns {Iterator}
*/
-export function* by(iterable, n) {
+export default function* by(iterable, n) {
const iterator = iter(iterable);
while (true) {
diff --git a/src/base/consume.js b/src/base/consume.js
index 2eefdbd..193d571 100644
--- a/src/base/consume.js
+++ b/src/base/consume.js
@@ -5,7 +5,7 @@
* @param {Number} n - The number of iterations to consume.
*
*/
-export function consume(iterator, n) {
+export default function consume(iterator, n) {
// eslint-disable-next-line no-empty
while (n-- > 0 && !iterator.next().done) {}
}
diff --git a/src/base/count.js b/src/base/count.js
index 32587fa..58414bc 100644
--- a/src/base/count.js
+++ b/src/base/count.js
@@ -1,4 +1,4 @@
-import {_count} from './_count.js';
+import _count from './_count.js';
/**
* Yields increasing or decreasing sequences of numbers. The starting value
@@ -18,6 +18,6 @@ import {_count} from './_count.js';
* @param {Number} [step=1] - The step between the values.
* @returns {Iterator}
*/
-export function count(start = 0, step = 1) {
+export default function count(start = 0, step = 1) {
return _count(start, step);
}
diff --git a/src/base/cycle.js b/src/base/cycle.js
index df3eb28..256c42c 100644
--- a/src/base/cycle.js
+++ b/src/base/cycle.js
@@ -6,10 +6,10 @@
* list(head(cycle(range(2)),7)) ;
*
* @param {Iterable} iterable - The input iterable.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*
*/
-export function* cycle(iterable) {
+export default function* cycle(iterable) {
const buffer = [];
for (const item of iterable) {
diff --git a/src/base/drop.js b/src/base/drop.js
index eec42ab..4731fa6 100644
--- a/src/base/drop.js
+++ b/src/base/drop.js
@@ -1,6 +1,5 @@
-import {iter} from './iter.js';
-import {consume} from './consume.js';
-import {tail} from './tail.js';
+import _drop from './_drop.js';
+import _tail from './_tail.js';
/**
* Drops the first n
values of the input iterable.
@@ -13,15 +12,8 @@ import {tail} from './tail.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} n - The number of values to drop.
- * @returns {Iterator} - The remaining values of the input iterable.
+ * @returns {IterableIterator} - The remaining values of the input iterable.
*/
-export function* drop(iterable, n) {
- if (n < 0) {
- yield* tail(iterable, -n);
- return;
- }
-
- const iterator = iter(iterable);
- consume(iterator, n);
- yield* iterator;
+export default function drop(iterable, n) {
+ return n < 0 ? _tail(iterable, -n) : _drop(iterable, n);
}
diff --git a/src/base/exhaust.js b/src/base/exhaust.js
index ffb3ed3..2234ece 100644
--- a/src/base/exhaust.js
+++ b/src/base/exhaust.js
@@ -9,7 +9,7 @@
* @param {Iterator} iterator - The input iterator.
*
*/
-export function exhaust(iterator) {
+export default function exhaust(iterator) {
// eslint-disable-next-line no-empty,no-unused-vars,prettier/prettier
for (const item of iterator) {}
}
diff --git a/src/base/first.js b/src/base/first.js
index 3859832..6c159a3 100644
--- a/src/base/first.js
+++ b/src/base/first.js
@@ -1,7 +1,8 @@
-import {next} from './next.js';
+import next from './next.js';
/**
* Same as {@link next}.
* @function first
*/
-export const first = next;
+const first = next;
+export default first;
diff --git a/src/base/frame.js b/src/base/frame.js
index a6b02f8..ad5415f 100644
--- a/src/base/frame.js
+++ b/src/base/frame.js
@@ -1,5 +1,5 @@
-import {iter} from './iter.js';
-import {range} from './range.js';
+import iter from './iter.js';
+import range from './range.js';
/**
* Yields tuples that contain the current element of the input iterable and the
@@ -15,7 +15,7 @@ import {range} from './range.js';
* @returns {Iterator}
*
*/
-export function* frame(iterable, n) {
+export default function* frame(iterable, n) {
// Could have an implementation using a deque
// that doesn't slice (and thus allocate a new
// vector everytime). Though the yield object
diff --git a/src/base/head.js b/src/base/head.js
index 95fe218..2c75da4 100644
--- a/src/base/head.js
+++ b/src/base/head.js
@@ -1,7 +1,8 @@
-import {take} from './take.js';
+import take from './take.js';
/**
* Same as {@link take}.
* @function head
*/
-export const head = take;
+const head = take;
+export default head;
diff --git a/src/base/index.js b/src/base/index.js
deleted file mode 100644
index eb3b713..0000000
--- a/src/base/index.js
+++ /dev/null
@@ -1,25 +0,0 @@
-export * from './StopIteration.js';
-export * from './_count.js';
-export * from './_next.js';
-export * from './_range.js';
-export * from './by.js';
-export * from './consume.js';
-export * from './count.js';
-export * from './cycle.js';
-export * from './drop.js';
-export * from './exhaust.js';
-export * from './first.js';
-export * from './frame.js';
-export * from './head.js';
-export * from './iter.js';
-export * from './last.js';
-export * from './len.js';
-export * from './list.js';
-export * from './ncycle.js';
-export * from './next.js';
-export * from './pick.js';
-export * from './range.js';
-export * from './tail.js';
-export * from './take.js';
-export * from './tee.js';
-export * from './trunc.js';
diff --git a/src/base/iter.js b/src/base/iter.js
index 85eb9e3..146f467 100644
--- a/src/base/iter.js
+++ b/src/base/iter.js
@@ -5,6 +5,6 @@
* @returns {Iterator}
*
*/
-export function iter(iterable) {
+export default function iter(iterable) {
return iterable[Symbol.iterator]();
}
diff --git a/src/base/last.js b/src/base/last.js
index 841312b..923f3d7 100644
--- a/src/base/last.js
+++ b/src/base/last.js
@@ -1,5 +1,5 @@
-import {next} from './next.js';
-import {tail} from './tail.js';
+import next from './next.js';
+import _tail from './_tail.js';
/**
* Returns the last value of the input iterable. If the iterable is
@@ -8,6 +8,6 @@ import {tail} from './tail.js';
* @param {Iterable} iterable - The input iterable.
* @returns {Object} The last value of the input iterable.
*/
-export function last(iterable) {
- return next(tail(iterable, 1));
+export default function last(iterable) {
+ return next(_tail(iterable, 1));
}
diff --git a/src/base/len.js b/src/base/len.js
index 6bca864..2068ad3 100644
--- a/src/base/len.js
+++ b/src/base/len.js
@@ -9,6 +9,6 @@
* @returns {Number}
*
*/
-export function len(array) {
+export default function len(array) {
return array.length;
}
diff --git a/src/base/list.js b/src/base/list.js
index 4668022..a5b5540 100644
--- a/src/base/list.js
+++ b/src/base/list.js
@@ -9,6 +9,6 @@
* @returns {Array}
*
*/
-export function list(iterable) {
+export default function list(iterable) {
return Array.from(iterable);
}
diff --git a/src/base/ncycle.js b/src/base/ncycle.js
index 8e2629f..72ddb68 100644
--- a/src/base/ncycle.js
+++ b/src/base/ncycle.js
@@ -10,7 +10,7 @@
* @returns {Iterator}
*
*/
-export function* ncycle(iterable, n) {
+export default function* ncycle(iterable, n) {
const buffer = [];
for (const item of iterable) {
diff --git a/src/base/next.js b/src/base/next.js
index 96b8d98..0fa6b17 100644
--- a/src/base/next.js
+++ b/src/base/next.js
@@ -1,4 +1,4 @@
-import {StopIteration} from './StopIteration.js';
+import StopIteration from './StopIteration.js';
/**
* Returns the next value of the input iterator. If the iterator is exhausted,
@@ -10,7 +10,7 @@ import {StopIteration} from './StopIteration.js';
* that the input iterator is exhausted.
* @returns {Object} The next value of the input iterator.
*/
-export function next(iterator, dflt = undefined) {
+export default function next(iterator, dflt = undefined) {
const x = iterator.next();
if (x.done) {
diff --git a/src/base/pick.js b/src/base/pick.js
index a43a846..af1d001 100644
--- a/src/base/pick.js
+++ b/src/base/pick.js
@@ -8,9 +8,9 @@
*
* @param {Object} object - The input object.
* @param {Iterable} iterable - The input iterable.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* pick(object, iterable) {
+export default function* pick(object, iterable) {
for (const key of iterable) {
yield object[key];
}
diff --git a/src/base/range.js b/src/base/range.js
index bf30ce2..5deac73 100644
--- a/src/base/range.js
+++ b/src/base/range.js
@@ -1,4 +1,4 @@
-import {_range} from './_range.js';
+import _range from './_range.js';
/**
* Yields values in a range, separated by a fixed constant called step. If this
@@ -10,9 +10,9 @@ import {_range} from './_range.js';
* @param {Number} [start=0] - The starting value.
* @param {Number} stop - The stopping value.
* @param {Number} [step=1] - The step value.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function range(start, stop, step) {
+export default function range(start, stop, step) {
if (stop === undefined) {
return _range(0, start, 1);
}
diff --git a/src/base/tail.js b/src/base/tail.js
index 6722d1d..7b4153b 100644
--- a/src/base/tail.js
+++ b/src/base/tail.js
@@ -1,6 +1,5 @@
-import deque from '@aureooms/js-collections-deque';
-
-import {drop} from './drop.js';
+import _drop from './_drop.js';
+import _tail from './_tail.js';
/**
* Returns the last n
values of the input iterable in an array.
@@ -13,13 +12,8 @@ import {drop} from './drop.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} n - The number of values to include in the output.
- * @returns {Iterator} - The last n
values of the input iterable.
+ * @returns {IterableIterator} - The last n
values of the input iterable.
*/
-export function* tail(iterable, n) {
- if (n < 0) {
- yield* drop(iterable, -n);
- return;
- }
-
- yield* deque(iterable, n);
+export default function tail(iterable, n) {
+ return n < 0 ? _drop(iterable, -n) : _tail(iterable, n);
}
diff --git a/src/base/take.js b/src/base/take.js
index 7d45e16..e9d6dd0 100644
--- a/src/base/take.js
+++ b/src/base/take.js
@@ -1,5 +1,5 @@
-import {iter} from './iter.js';
-import {trunc} from './trunc.js';
+import _trunc from './_trunc.js';
+import _take from './_take.js';
/**
* Yields the first n
elements of the input iterable. If
@@ -12,23 +12,8 @@ import {trunc} from './trunc.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} n - The number of elements to include in the output.
- * @returns {Iterator} - The first n
elements of the input iterable.
+ * @returns {IterableIterator} - The first n
elements of the input iterable.
*/
-export function* take(iterable, n) {
- if (n < 0) {
- yield* trunc(iterable, -n);
- return;
- }
-
- const iterator = iter(iterable);
-
- while (n-- > 0) {
- const current = iterator.next();
-
- if (current.done) {
- return;
- }
-
- yield current.value;
- }
+export default function take(iterable, n) {
+ return n < 0 ? _trunc(iterable, -n) : _take(iterable, n);
}
diff --git a/src/base/tee.js b/src/base/tee.js
index b47f425..0cec12e 100644
--- a/src/base/tee.js
+++ b/src/base/tee.js
@@ -1,6 +1,6 @@
-import {iter} from './iter.js';
-import {list} from './list.js';
-import {map} from '../map/map.js';
+import iter from './iter.js';
+import list from './list.js';
+import map from '../map/map.js';
import deque from '@aureooms/js-collections-deque';
@@ -13,7 +13,7 @@ import deque from '@aureooms/js-collections-deque';
* @param {Number} n - The number of copies to make.
* @returns {Iterator[]}
*/
-export function tee(iterable, n) {
+export default function tee(iterable, n) {
const iterator = iter(iterable);
const copies = [];
diff --git a/src/base/trunc.js b/src/base/trunc.js
index 065d77c..625d1fb 100644
--- a/src/base/trunc.js
+++ b/src/base/trunc.js
@@ -1,7 +1,5 @@
-import deque from '@aureooms/js-collections-deque';
-
-import {iter} from './iter.js';
-import {take} from './take.js';
+import _take from './_take.js';
+import _trunc from './_trunc.js';
/**
* Yields all elements of the iterable except the last n
ones. If
@@ -14,34 +12,8 @@ import {take} from './take.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} n - The number of elements to exclude from the output.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* trunc(iterable, n) {
- if (n < 0) {
- yield* take(iterable, -n);
- return;
- }
-
- if (n === 0) {
- yield* iterable;
- return;
- }
-
- const iterator = iter(iterable);
-
- const buffer = deque(null, n);
-
- while (n-- > 0) {
- const event = iterator.next();
- if (event.done) {
- return;
- }
-
- buffer.append(event.value);
- }
-
- for (const value of iterator) {
- yield buffer.popleft();
- buffer.append(value);
- }
+export default function trunc(iterable, n) {
+ return n < 0 ? _take(iterable, -n) : _trunc(iterable, n);
}
diff --git a/src/extra/closure.js b/src/extra/closure.js
index cc64687..66ad03d 100644
--- a/src/extra/closure.js
+++ b/src/extra/closure.js
@@ -15,7 +15,7 @@
* @param {Object} start The starting element.
* @returns {Iterator} Iterator over the closure.
*/
-export function* closure(operator, start) {
+export default function* closure(operator, start) {
yield start;
let element = start;
diff --git a/src/extra/diagonal.js b/src/extra/diagonal.js
index 7e4b10a..e30e2f7 100644
--- a/src/extra/diagonal.js
+++ b/src/extra/diagonal.js
@@ -1,6 +1,8 @@
import deque from '@aureooms/js-collections-deque';
-import {iter, _next, count} from '../base/index.js';
+import iter from '../base/iter.js';
+import _next from '../base/_next.js';
+import count from '../base/count.js';
/**
* Computes the product of two iterables in a way that allows for one or both
@@ -23,7 +25,7 @@ import {iter, _next, count} from '../base/index.js';
* @returns {Iterator}
*
*/
-export function* diagonal(A, B) {
+export default function* diagonal(A, B) {
const itA = iter(A);
const itB = iter(B);
const _A = deque();
diff --git a/src/extra/index.js b/src/extra/index.js
deleted file mode 100644
index 3954506..0000000
--- a/src/extra/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './closure.js';
-export * from './diagonal.js';
-export * from './nth.js';
diff --git a/src/extra/nth.js b/src/extra/nth.js
index ce458e4..4406958 100644
--- a/src/extra/nth.js
+++ b/src/extra/nth.js
@@ -1,5 +1,8 @@
import deque from '@aureooms/js-collections-deque';
-import {next, drop, StopIteration} from '../base/index.js';
+
+import drop from '../base/drop.js';
+import next from '../base/next.js';
+import StopIteration from '../base/StopIteration.js';
/**
* Returns the n
th value of the input iterable (n
@@ -16,7 +19,7 @@ import {next, drop, StopIteration} from '../base/index.js';
* @param {Number} n - The index of the value to output.
* @returns {Object} The n
th value of the input iterable.
*/
-export function nth(iterable, n) {
+export default function nth(iterable, n) {
if (n < 0) {
const deq = deque(iterable, -n);
if (deq.len() < -n) throw new StopIteration();
diff --git a/src/index.js b/src/index.js
index f59f8b7..a32dd3b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,4 +1,64 @@
-export * from './base/index.js';
-export * from './extra/index.js';
-export * from './map/index.js';
-export * from './reduce/index.js';
+export {default as StopIteration} from './base/StopIteration.js';
+export {default as _count} from './base/_count.js';
+export {default as _next} from './base/_next.js';
+export {default as _range} from './base/_range.js';
+export {default as by} from './base/by.js';
+export {default as consume} from './base/consume.js';
+export {default as count} from './base/count.js';
+export {default as cycle} from './base/cycle.js';
+export {default as drop} from './base/drop.js';
+export {default as exhaust} from './base/exhaust.js';
+export {default as first} from './base/first.js';
+export {default as frame} from './base/frame.js';
+export {default as head} from './base/head.js';
+export {default as iter} from './base/iter.js';
+export {default as last} from './base/last.js';
+export {default as len} from './base/len.js';
+export {default as list} from './base/list.js';
+export {default as ncycle} from './base/ncycle.js';
+export {default as next} from './base/next.js';
+export {default as pick} from './base/pick.js';
+export {default as range} from './base/range.js';
+export {default as tail} from './base/tail.js';
+export {default as take} from './base/take.js';
+export {default as tee} from './base/tee.js';
+export {default as trunc} from './base/trunc.js';
+export {default as closure} from './extra/closure.js';
+export {default as diagonal} from './extra/diagonal.js';
+export {default as nth} from './extra/nth.js';
+export {default as _product} from './map/_product.js';
+export {default as _zip} from './map/_zip.js';
+export {default as _zip2} from './map/_zip2.js';
+export {default as _ziplongest} from './map/_ziplongest.js';
+export {default as chain} from './map/chain.js';
+export {default as combinations} from './map/combinations.js';
+export {default as combinationswithrepetition} from './map/combinationswithrepetition.js';
+export {default as compress} from './map/compress.js';
+export {default as dropwhile} from './map/dropwhile.js';
+export {default as enumerate} from './map/enumerate.js';
+export {default as filter} from './map/filter.js';
+export {default as filterfalse} from './map/filterfalse.js';
+export {default as filtertrue} from './map/filtertrue.js';
+export {default as group} from './map/group.js';
+export {default as map} from './map/map.js';
+export {default as nrepeat} from './map/nrepeat.js';
+export {default as permutations} from './map/permutations.js';
+export {default as product} from './map/product.js';
+export {default as repeat} from './map/repeat.js';
+export {default as reversed} from './map/reversed.js';
+export {default as roundrobin} from './map/roundrobin.js';
+export {default as slice} from './map/slice.js';
+export {default as sorted} from './map/sorted.js';
+export {default as starmap} from './map/starmap.js';
+export {default as takewhile} from './map/takewhile.js';
+export {default as zip} from './map/zip.js';
+export {default as ziplongest} from './map/ziplongest.js';
+export {default as _reduce} from './reduce/_reduce.js';
+export {default as _sum} from './reduce/_sum.js';
+export {default as all} from './reduce/all.js';
+export {default as any} from './reduce/any.js';
+export {default as max} from './reduce/max.js';
+export {default as min} from './reduce/min.js';
+export {default as reduce} from './reduce/reduce.js';
+export {default as some} from './reduce/some.js';
+export {default as sum} from './reduce/sum.js';
diff --git a/src/map/_product.js b/src/map/_product.js
index 12a6615..9f86f40 100644
--- a/src/map/_product.js
+++ b/src/map/_product.js
@@ -15,7 +15,7 @@
* @param {Number} n - Number of pools in total.
* @returns {Iterator}
*/
-export function* _product(pools, i, n) {
+export default function* _product(pools, i, n) {
if (i === n) {
yield [];
return;
diff --git a/src/map/_zip.js b/src/map/_zip.js
index 274d210..80bca55 100644
--- a/src/map/_zip.js
+++ b/src/map/_zip.js
@@ -1,4 +1,7 @@
-import {list, map, iter, _next} from '../index.js';
+import iter from '../base/iter.js';
+import list from '../base/list.js';
+import _next from '../base/_next.js';
+import map from './map.js';
/**
* Zips iterables together. Yields a tuple containing the first element of each
@@ -10,10 +13,10 @@ import {list, map, iter, _next} from '../index.js';
* list( _zip( [ 'abcd' , range(3) ] ) ) ;
*
* @param {Iterable[]} iterables - The iterables to zip.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*
*/
-export function* _zip(iterables) {
+export default function* _zip(iterables) {
const iterators = list(map(iter, iterables));
if (iterators.length === 0) {
diff --git a/src/map/_zip2.js b/src/map/_zip2.js
index 8ba121d..3b80fd9 100644
--- a/src/map/_zip2.js
+++ b/src/map/_zip2.js
@@ -1,4 +1,4 @@
-import {iter} from '../index.js';
+import iter from '../base/iter.js';
/**
* Zips exactly two iterables together. Yields a tuple containing the first
@@ -11,20 +11,20 @@ import {iter} from '../index.js';
*
* @param {Iterable} A - The first iterable.
* @param {Iterable} B - The second iterable.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*
*/
-export function* _zip2(A, B) {
- A = iter(A);
- B = iter(B);
+export default function* _zip2(A, B) {
+ const iA = iter(A);
+ const iB = iter(B);
while (true) {
- const a = A.next();
+ const a = iA.next();
if (a.done) {
return;
}
- const b = B.next();
+ const b = iB.next();
if (b.done) {
return;
}
diff --git a/src/map/_ziplongest.js b/src/map/_ziplongest.js
index 32672b2..374b107 100644
--- a/src/map/_ziplongest.js
+++ b/src/map/_ziplongest.js
@@ -1,4 +1,9 @@
-import {list, map, iter, _next, repeat, enumerate} from '../index.js';
+import iter from '../base/iter.js';
+import list from '../base/list.js';
+import _next from '../base/_next.js';
+import enumerate from './enumerate.js';
+import map from './map.js';
+import repeat from './repeat.js';
/**
* Same as _zip, but continues to yield zipped tuples until the last iterable is
@@ -8,12 +13,12 @@ import {list, map, iter, _next, repeat, enumerate} from '../index.js';
* // returns [['A','x'],['B','y'],['C','-'],['D','-']]
* list( _ziplongest( '-' , [ 'ABCD', 'xy' ] ) ) ;
*
- * @param fillvalue - The value to yield for iterators that are exhausted.
+ * @param {any} fillvalue - The value to yield for iterators that are exhausted.
* @param {Iterable[]} iterables - The iterables to zip.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*
*/
-export function* _ziplongest(fillvalue, iterables) {
+export default function* _ziplongest(fillvalue, iterables) {
let counter = iterables.length;
if (counter === 0) {
diff --git a/src/map/chain.js b/src/map/chain.js
index 78225ac..8d0dd49 100644
--- a/src/map/chain.js
+++ b/src/map/chain.js
@@ -10,7 +10,7 @@
* @returns {Iterator}
*
*/
-export function* chain(iterables) {
+export default function* chain(iterables) {
for (const iterable of iterables) {
yield* iterable;
}
diff --git a/src/map/combinations.js b/src/map/combinations.js
index ef3b8fa..dcf16ae 100644
--- a/src/map/combinations.js
+++ b/src/map/combinations.js
@@ -1,4 +1,6 @@
-import {list, range, pick} from '../index.js';
+import list from '../base/list.js';
+import pick from '../base/pick.js';
+import range from '../base/range.js';
/**
* Yields all combinations of each possible choice of r
elements
@@ -14,9 +16,9 @@ import {list, range, pick} from '../index.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} r - The size of the combinations to generate.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* combinations(iterable, r) {
+export default function* combinations(iterable, r) {
const pool = list(iterable);
const length = pool.length;
diff --git a/src/map/combinationswithrepetition.js b/src/map/combinationswithrepetition.js
index f4dbca5..74b97b3 100644
--- a/src/map/combinationswithrepetition.js
+++ b/src/map/combinationswithrepetition.js
@@ -1,4 +1,6 @@
-import {list, nrepeat, pick} from '../index.js';
+import list from '../base/list.js';
+import pick from '../base/pick.js';
+import nrepeat from './nrepeat.js';
/**
* Yields all combinations, with repetitions, of each possible choice of
@@ -14,10 +16,9 @@ import {list, nrepeat, pick} from '../index.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} r - The size of the combinations to generate.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-
-export function* combinationswithrepetition(iterable, r) {
+export default function* combinationswithrepetition(iterable, r) {
const pool = list(iterable);
const length = pool.length;
diff --git a/src/map/compress.js b/src/map/compress.js
index 711c30d..279c051 100644
--- a/src/map/compress.js
+++ b/src/map/compress.js
@@ -1,4 +1,4 @@
-import {_zip2} from '../index.js';
+import _zip2 from './_zip2.js';
/**
* Filters the first input iterable according to truthy and flasy values from a
@@ -10,7 +10,7 @@ import {_zip2} from '../index.js';
* values.
* @returns {Iterator}
*/
-export function* compress(iterable, selector) {
+export default function* compress(iterable, selector) {
for (const [take, item] of _zip2(selector, iterable)) {
if (take) {
yield item;
diff --git a/src/map/dropwhile.js b/src/map/dropwhile.js
index d100daa..da4446d 100644
--- a/src/map/dropwhile.js
+++ b/src/map/dropwhile.js
@@ -1,4 +1,4 @@
-import {iter} from '../index.js';
+import iter from '../base/iter.js';
/**
* Drop elements of the input iterable while the current element satisfies the
@@ -8,7 +8,7 @@ import {iter} from '../index.js';
* @param {Iterable} iterable - The input iterable.
* @returns {Iterator}
*/
-export function* dropwhile(predicate, iterable) {
+export default function* dropwhile(predicate, iterable) {
const iterator = iter(iterable);
for (const item of iterator) {
diff --git a/src/map/enumerate.js b/src/map/enumerate.js
index 614b98e..2ede2fa 100644
--- a/src/map/enumerate.js
+++ b/src/map/enumerate.js
@@ -1,4 +1,5 @@
-import {_zip2, _count} from '../index.js';
+import _count from '../base/_count.js';
+import _zip2 from './_zip2.js';
/**
* Yields (index,element) tuples where the elements are taken from the input
@@ -15,8 +16,8 @@ import {_zip2, _count} from '../index.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} [start=0] - The starting index.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function enumerate(iterable, start = 0) {
+export default function enumerate(iterable, start = 0) {
return _zip2(_count(start, 1), iterable);
}
diff --git a/src/map/filter.js b/src/map/filter.js
index 53c4b57..39a85c1 100644
--- a/src/map/filter.js
+++ b/src/map/filter.js
@@ -11,16 +11,10 @@
* @returns {Iterator}
*
*/
-export function* filter(predicate, iterable) {
+export default function* filter(predicate, iterable) {
for (const item of iterable) {
if (predicate(item)) {
yield item;
}
}
}
-
-/**
- * Same as {@link filter}.
- * @function filtertrue
- */
-export const filtertrue = filter;
diff --git a/src/map/filterfalse.js b/src/map/filterfalse.js
index 7687136..387b368 100644
--- a/src/map/filterfalse.js
+++ b/src/map/filterfalse.js
@@ -11,7 +11,7 @@
* @returns {Iterator}
*
*/
-export function* filterfalse(predicate, iterable) {
+export default function* filterfalse(predicate, iterable) {
for (const item of iterable) {
if (!predicate(item)) {
yield item;
diff --git a/src/map/filtertrue.js b/src/map/filtertrue.js
new file mode 100644
index 0000000..6aa8e35
--- /dev/null
+++ b/src/map/filtertrue.js
@@ -0,0 +1,8 @@
+import filter from './filter.js';
+
+/**
+ * Same as {@link filter}.
+ * @function filtertrue
+ */
+const filtertrue = filter;
+export default filtertrue;
diff --git a/src/map/group.js b/src/map/group.js
index b7a4224..679a8f6 100644
--- a/src/map/group.js
+++ b/src/map/group.js
@@ -1,4 +1,4 @@
-import {iter} from '../index.js';
+import iter from '../base/iter.js';
/**
* Yields elements of the input iterable by grouping them into tuples
@@ -17,7 +17,7 @@ import {iter} from '../index.js';
* @param {Iterable} iterable - The input iterable.
* @returns {Iterator}
*/
-export function* group(key, iterable) {
+export default function* group(key, iterable) {
const iterator = iter(iterable);
const first = iterator.next();
diff --git a/src/map/index.js b/src/map/index.js
deleted file mode 100644
index db740bf..0000000
--- a/src/map/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-export * from './_product.js';
-export * from './_zip.js';
-export * from './_zip2.js';
-export * from './_ziplongest.js';
-export * from './chain.js';
-export * from './combinations.js';
-export * from './combinationswithrepetition.js';
-export * from './compress.js';
-export * from './dropwhile.js';
-export * from './enumerate.js';
-export * from './filter.js';
-export * from './filterfalse.js';
-export * from './group.js';
-export * from './map.js';
-export * from './nrepeat.js';
-export * from './permutations.js';
-export * from './product.js';
-export * from './repeat.js';
-export * from './reversed.js';
-export * from './roundrobin.js';
-export * from './slice.js';
-export * from './sorted.js';
-export * from './starmap.js';
-export * from './takewhile.js';
-export * from './zip.js';
-export * from './ziplongest.js';
diff --git a/src/map/map.js b/src/map/map.js
index aaa309a..1d0b49e 100644
--- a/src/map/map.js
+++ b/src/map/map.js
@@ -7,9 +7,9 @@
*
* @param {Function} callable - The callable to use.
* @param {Iterable} iterable - The input iterable.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* map(callable, iterable) {
+export default function* map(callable, iterable) {
for (const item of iterable) {
yield callable(item);
}
diff --git a/src/map/nrepeat.js b/src/map/nrepeat.js
index f96ee49..2d63e78 100644
--- a/src/map/nrepeat.js
+++ b/src/map/nrepeat.js
@@ -5,11 +5,11 @@
* @example
* list( nrepeat( 6 , 3 ) ) ; // returns [ 6 , 6 , 6 ]
*
- * @param {Object} item - The input item.
+ * @param {any} item - The input item.
* @param {Number} times - The number of times to yield item
.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* nrepeat(item, times) {
+export default function* nrepeat(item, times) {
while (times-- > 0) {
yield item;
}
diff --git a/src/map/permutations.js b/src/map/permutations.js
index 93b3a4c..f90bc07 100644
--- a/src/map/permutations.js
+++ b/src/map/permutations.js
@@ -1,4 +1,8 @@
-import {list, range, head, pick} from '../index.js';
+import assert from 'assert';
+import _take from '../base/_take.js';
+import list from '../base/list.js';
+import pick from '../base/pick.js';
+import range from '../base/range.js';
/**
* Yields all permutations of each possible choice of r
elements
@@ -14,9 +18,10 @@ import {list, range, head, pick} from '../index.js';
*
* @param {Iterable} iterable - The input iterable.
* @param {Number} r - The size of the permutations to generate.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* permutations(iterable, r) {
+export default function* permutations(iterable, r) {
+ assert(Number.isInteger(r) && r >= 0);
const pool = list(iterable);
const length = pool.length;
@@ -28,7 +33,7 @@ export function* permutations(iterable, r) {
const indices = list(range(0, length, 1));
const cycles = list(range(length, length - r, -1));
- yield list(pick(pool, head(indices, r)));
+ yield list(pick(pool, _take(indices, r)));
if (r === 0 || length === 0) {
return;
@@ -50,7 +55,7 @@ export function* permutations(iterable, r) {
[indices[i], indices[length - j]] = [indices[length - j], indices[i]];
- yield list(pick(pool, head(indices, r)));
+ yield list(pick(pool, _take(indices, r)));
break;
}
}
diff --git a/src/map/product.js b/src/map/product.js
index 56a7b7c..e7849c1 100644
--- a/src/map/product.js
+++ b/src/map/product.js
@@ -1,4 +1,8 @@
-import {list, map, _product, ncycle, reversed} from '../index.js';
+import list from '../base/list.js';
+import ncycle from '../base/ncycle.js';
+import map from './map.js';
+import reversed from './reversed.js';
+import _product from './_product.js';
/**
* Computes the product of the iterables given as first parameter. The second
@@ -20,7 +24,7 @@ import {list, map, _product, ncycle, reversed} from '../index.js';
* @return {Iterator}
*/
-export function product(iterables, repeat = 1) {
+export default function product(iterables, repeat = 1) {
const pools = list(ncycle(reversed(map(list, iterables)), repeat));
return map(list, _product(pools, 0, pools.length));
diff --git a/src/map/repeat.js b/src/map/repeat.js
index dcef2eb..28f9c85 100644
--- a/src/map/repeat.js
+++ b/src/map/repeat.js
@@ -8,7 +8,7 @@
* @param {Object} item - The input item.
* @returns {Iterator}
*/
-export function* repeat(item) {
+export default function* repeat(item) {
while (true) {
yield item;
}
diff --git a/src/map/reversed.js b/src/map/reversed.js
index ebac01b..cc00835 100644
--- a/src/map/reversed.js
+++ b/src/map/reversed.js
@@ -4,7 +4,7 @@
* @param {Iterable} iterable - The input iterable.
* @returns {Iterator} - The input iterable, reversed.
*/
-export function* reversed(iterable) {
+export default function* reversed(iterable) {
const buffer = [];
for (const item of iterable) {
diff --git a/src/map/roundrobin.js b/src/map/roundrobin.js
index 30bb0e4..76e71be 100644
--- a/src/map/roundrobin.js
+++ b/src/map/roundrobin.js
@@ -1,4 +1,8 @@
-import {iter, len, cycle, map, slice} from '../index.js';
+import cycle from '../base/cycle.js';
+import iter from '../base/iter.js';
+import len from '../base/len.js';
+import map from './map.js';
+import slice from './slice.js';
/**
* Yields the first item of the first input iterable, then the first item of
@@ -12,10 +16,10 @@ import {iter, len, cycle, map, slice} from '../index.js';
* list( roundrobin(['ABC', 'D', 'EF']) )
*
* @param {Iterable[]} iterables - The input iterables.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*
*/
-export function* roundrobin(iterables) {
+export default function* roundrobin(iterables) {
let pending = len(iterables);
let iterators = cycle(map(iter, iterables));
diff --git a/src/map/slice.js b/src/map/slice.js
index 065e9d8..80a2ae0 100644
--- a/src/map/slice.js
+++ b/src/map/slice.js
@@ -1,4 +1,4 @@
-import {iter} from '../index.js';
+import iter from '../base/iter.js';
/**
* Same as
@@ -9,9 +9,9 @@ import {iter} from '../index.js';
* @param {Number} start - Where to start the slice.
* @param {Number} stop - Where to stop the slice.
* @param {Number} step - The step of the slice.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*/
-export function* slice(iterable, start, stop, step) {
+export default function* slice(iterable, start, stop, step) {
const iterator = iter(iterable);
while (start > 0) {
diff --git a/src/map/sorted.js b/src/map/sorted.js
index d6607a6..ce38e00 100644
--- a/src/map/sorted.js
+++ b/src/map/sorted.js
@@ -1,4 +1,4 @@
-import {list} from '../base/list.js';
+import list from '../base/list.js';
/**
* Outputs an array containing the elements of the input iterable sorted
@@ -11,6 +11,6 @@ import {list} from '../base/list.js';
* @param {Iterable} iterable - The input iterable.
* @returns {Array} - The input iterable, sorted.
*/
-export function sorted(compare, iterable) {
+export default function sorted(compare, iterable) {
return list(iterable).sort(compare);
}
diff --git a/src/map/starmap.js b/src/map/starmap.js
index 1fdb585..7d000e8 100644
--- a/src/map/starmap.js
+++ b/src/map/starmap.js
@@ -9,7 +9,7 @@
* @param {Iterable} iterable - The input iterable.
* @returns {Iterator}
*/
-export function* starmap(callable, iterable) {
+export default function* starmap(callable, iterable) {
for (const args of iterable) {
yield callable(...args);
}
diff --git a/src/map/takewhile.js b/src/map/takewhile.js
index 705cb86..e2c3ef0 100644
--- a/src/map/takewhile.js
+++ b/src/map/takewhile.js
@@ -6,7 +6,7 @@
* @param {Iterable} iterable - The input iterable.
* @returns {Iterator}
*/
-export function* takewhile(predicate, iterable) {
+export default function* takewhile(predicate, iterable) {
for (const item of iterable) {
if (!predicate(item)) {
return;
diff --git a/src/map/zip.js b/src/map/zip.js
index b948751..401edde 100644
--- a/src/map/zip.js
+++ b/src/map/zip.js
@@ -1,4 +1,4 @@
-import {_zip} from './_zip.js';
+import _zip from './_zip.js';
/**
* Zips iterables together. Yields a tuple containing the first element of each
@@ -13,6 +13,6 @@ import {_zip} from './_zip.js';
* @returns {Iterator}
*
*/
-export function zip(...iterables) {
+export default function zip(...iterables) {
return _zip(iterables);
}
diff --git a/src/map/ziplongest.js b/src/map/ziplongest.js
index 5a0e2fa..cd74068 100644
--- a/src/map/ziplongest.js
+++ b/src/map/ziplongest.js
@@ -1,4 +1,4 @@
-import {_ziplongest} from './_ziplongest.js';
+import _ziplongest from './_ziplongest.js';
/**
* Same as zip, but continues to yield zipped tuples until the last iterable is
@@ -8,11 +8,11 @@ import {_ziplongest} from './_ziplongest.js';
* // returns [['A','x'],['B','y'],['C','-'],['D','-']]
* list( ziplongest( '-' , 'ABCD', 'xy' ) ) ;
*
- * @param fillvalue - The value to yield for iterators that are exhausted.
+ * @param {any} fillvalue - The value to yield for iterators that are exhausted.
* @param {...Iterable} iterables - The iterables to zip.
- * @returns {Iterator}
+ * @returns {IterableIterator}
*
*/
-export function ziplongest(fillvalue, ...iterables) {
+export default function ziplongest(fillvalue, ...iterables) {
return _ziplongest(fillvalue, iterables);
}
diff --git a/src/reduce/_reduce.js b/src/reduce/_reduce.js
index 02e792b..065640a 100644
--- a/src/reduce/_reduce.js
+++ b/src/reduce/_reduce.js
@@ -14,7 +14,7 @@
* @param {Object} initializer - The initial value of the reduction.
* @returns {Object} - The reduction of the elements of iterable
.
*/
-export function _reduce(accumulator, iterable, initializer) {
+export default function _reduce(accumulator, iterable, initializer) {
for (const item of iterable) {
initializer = accumulator(initializer, item);
}
diff --git a/src/reduce/_sum.js b/src/reduce/_sum.js
index be8f751..fbbba3bb 100644
--- a/src/reduce/_sum.js
+++ b/src/reduce/_sum.js
@@ -14,7 +14,7 @@
* iterable
.
*
*/
-export function _sum(iterable, initializer) {
+export default function _sum(iterable, initializer) {
for (const item of iterable) {
initializer += item;
}
diff --git a/src/reduce/all.js b/src/reduce/all.js
index 1e34dab..cf34a14 100644
--- a/src/reduce/all.js
+++ b/src/reduce/all.js
@@ -14,7 +14,7 @@
* @returns {Boolean} Returns true
if all element of
* iterable
are truthy, false
otherwise.
*/
-export function all(iterable) {
+export default function all(iterable) {
for (const item of iterable) {
if (!item) {
return false;
diff --git a/src/reduce/any.js b/src/reduce/any.js
index 900d9f9..045eb00 100644
--- a/src/reduce/any.js
+++ b/src/reduce/any.js
@@ -14,7 +14,7 @@
* @returns {Boolean} Returns true
if any element of
* iterable
is truthy, false
otherwise.
*/
-export function any(iterable) {
+export default function any(iterable) {
for (const item of iterable) {
if (item) {
return true;
diff --git a/src/reduce/index.js b/src/reduce/index.js
deleted file mode 100644
index 7304547..0000000
--- a/src/reduce/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export * from './_reduce.js';
-export * from './_sum.js';
-export * from './all.js';
-export * from './any.js';
-export * from './max.js';
-export * from './min.js';
-export * from './reduce.js';
-export * from './some.js';
-export * from './sum.js';
diff --git a/src/reduce/max.js b/src/reduce/max.js
index 09e2481..a67c5b8 100644
--- a/src/reduce/max.js
+++ b/src/reduce/max.js
@@ -1,4 +1,4 @@
-import {iter} from '../base/iter.js';
+import iter from '../base/iter.js';
/**
* Returns the largest element of the input iterable according
@@ -20,7 +20,7 @@ import {iter} from '../base/iter.js';
* @returns {Object} The largest element of iterable
according to
* compare
.
*/
-export function max(compare, iterable, dflt = undefined) {
+export default function max(compare, iterable, dflt = undefined) {
const iterator = iter(iterable);
const first = iterator.next();
diff --git a/src/reduce/min.js b/src/reduce/min.js
index be81fba..ea6b8d9 100644
--- a/src/reduce/min.js
+++ b/src/reduce/min.js
@@ -1,4 +1,4 @@
-import {iter} from '../base/iter.js';
+import iter from '../base/iter.js';
/**
* Returns the smallest element of the input iterable according
@@ -20,7 +20,7 @@ import {iter} from '../base/iter.js';
* @returns {Object} The smallest element of iterable
according to
* compare
.
*/
-export function min(compare, iterable, dflt = undefined) {
+export default function min(compare, iterable, dflt = undefined) {
const iterator = iter(iterable);
const first = iterator.next();
diff --git a/src/reduce/reduce.js b/src/reduce/reduce.js
index 461a3a5..75ed7a8 100644
--- a/src/reduce/reduce.js
+++ b/src/reduce/reduce.js
@@ -1,5 +1,5 @@
-import {_reduce} from './_reduce.js';
-import {iter} from '../base/iter.js';
+import _reduce from './_reduce.js';
+import iter from '../base/iter.js';
/**
* Applies the accumulator function iteratively on the last return value of the
@@ -18,7 +18,7 @@ import {iter} from '../base/iter.js';
* @param {Object} [initializer=undefined] - The initial value of the reduction.
* @returns {Object} - The reduction of the elements of iterable
.
*/
-export function reduce(accumulator, iterable, initializer = undefined) {
+export default function reduce(accumulator, iterable, initializer = undefined) {
if (initializer === undefined) {
const iterator = iter(iterable);
const first = iterator.next();
diff --git a/src/reduce/some.js b/src/reduce/some.js
index 83963db..0434149 100644
--- a/src/reduce/some.js
+++ b/src/reduce/some.js
@@ -20,7 +20,7 @@
* elements of iterable
are truthy, false
otherwise.
*/
-export function some(iterable, n) {
+export default function some(iterable, n) {
if (n <= 0) {
return true;
}
diff --git a/src/reduce/sum.js b/src/reduce/sum.js
index 3cc71d1..a10cb6c 100644
--- a/src/reduce/sum.js
+++ b/src/reduce/sum.js
@@ -1,4 +1,4 @@
-import {_sum} from './_sum.js';
+import _sum from './_sum.js';
/**
* Sums the elements of the input iterable. An optional initializer parameter
@@ -17,6 +17,6 @@ import {_sum} from './_sum.js';
* iterable
.
*
*/
-export function sum(iterable, initializer = 0) {
+export default function sum(iterable, initializer = 0) {
return _sum(iterable, initializer);
}