Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/augmentative-iterable.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ function augmentativeForEach(

function augmentativeToArray() {
const result = [];

augmentativeForEach.call(this, result.push.bind(result));

for (const item of this) result.push(item);
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "augmentative-iterable",
"description": "This project is just a template for creation of new projects",
"version": "1.6.0",
"version": "1.6.1",
"private": false,
"author": {
"name": "Thiago O Santos <tos.oliveira@gmail.com>"
Expand Down
5 changes: 3 additions & 2 deletions test/unit/iterable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
addMapAsync,
flatMapIterable,
skipIterable,
augmentativeToArrayAsync,
} from '../../index';
import { expect } from 'chai';
import { stub } from 'sinon';
Expand Down Expand Up @@ -254,7 +255,7 @@ describe('Iterable', () => {
expect(result).to.be.eql([2, 3]);
});

it('should respect filter and takeWhile through operations', () => {
it('should respect filter and takeWhile through operations', async () => {
const callFilter = stub().callsFake((x) => x !== 2);
const callTakeWhile = stub().callsFake((x) => x < 4);
const callMap = stub().callsFake((x) => x);
Expand All @@ -263,7 +264,7 @@ describe('Iterable', () => {
const takeWhile = addTakeWhile(filter, callTakeWhile);
const map: any = addMapAsync(takeWhile, callMap);

const result = augmentativeToArray.call(map);
const result = await augmentativeToArrayAsync.call(map);

expect(result).to.be.eql([1, 3]);
expect(callFilter).to.have.callsLike([1], [2], [3], [4]);
Expand Down