@@ -29,37 +29,6 @@ var iterEmpty = require( '@stdlib/iter/empty' );
2929var iterMapN = require ( './../lib' ) ;
3030
3131
32- // FUNCTIONS //
33-
34- function createIterator ( arr ) {
35- var len ;
36- var it ;
37- var i ;
38-
39- len = arr . length ;
40- i = - 1 ;
41-
42- it = { } ;
43- it . next = next ;
44-
45- return it ;
46-
47- function next ( ) {
48- var out ;
49- i += 1 ;
50- if ( i < len ) {
51- out = { } ;
52- out . value = arr [ i ] ;
53- out . done = ( i === len - 1 ) ;
54- return out ;
55- }
56- return {
57- 'done' : true
58- } ;
59- }
60- }
61-
62-
6332// TESTS //
6433
6534tape ( 'main export is a function' , function test ( t ) {
@@ -749,45 +718,6 @@ tape( 'the function returns an iterator protocol-compliant object which applies
749718 }
750719} ) ;
751720
752- tape ( 'the function returns an iterator protocol-compliant object which applies a function to iterated values (value+done)' , function test ( t ) {
753- var expected ;
754- var values1 ;
755- var values2 ;
756- var actual ;
757- var it ;
758- var i ;
759-
760- values1 = [ 1.0 , 2.0 ] ;
761- values2 = [ 3.0 , 4.0 ] ;
762- expected = [
763- {
764- 'value' : 4.0 ,
765- 'done' : false
766- } ,
767- {
768- 'value' : 6.0 ,
769- 'done' : false
770- } ,
771- {
772- 'done' : true
773- }
774- ] ;
775-
776- it = iterMapN ( createIterator ( values1 ) , createIterator ( values2 ) , transform ) ; // eslint-disable-line max-len
777- t . equal ( it . next . length , 0 , 'has zero arity' ) ;
778-
779- actual = [ ] ;
780- for ( i = 0 ; i < expected . length ; i ++ ) {
781- actual . push ( it . next ( ) ) ;
782- }
783- t . deepEqual ( actual , expected , 'returns expected values' ) ;
784- t . end ( ) ;
785-
786- function transform ( x , y ) {
787- return x + y ;
788- }
789- } ) ;
790-
791721tape ( 'the function invokes a provided callback with iterated values and the iteration index' , function test ( t ) {
792722 var expected ;
793723 var values1 ;
@@ -872,51 +802,6 @@ tape( 'the function supports specifying the callback execution context', functio
872802 }
873803} ) ;
874804
875- tape ( 'the function supports specifying the callback execution context (value+done)' , function test ( t ) {
876- var expected ;
877- var values1 ;
878- var values2 ;
879- var actual ;
880- var ctx ;
881- var it ;
882- var i ;
883-
884- ctx = {
885- 'count' : 0
886- } ;
887- values1 = [ 1.0 , 2.0 ] ;
888- values2 = [ 3.0 , 4.0 ] ;
889- expected = [
890- {
891- 'value' : 4.0 ,
892- 'done' : false
893- } ,
894- {
895- 'value' : 6.0 ,
896- 'done' : false
897- } ,
898- {
899- 'done' : true
900- }
901- ] ;
902-
903- it = iterMapN ( createIterator ( values1 ) , createIterator ( values2 ) , transform , ctx ) ; // eslint-disable-line max-len
904- t . equal ( it . next . length , 0 , 'has zero arity' ) ;
905-
906- actual = [ ] ;
907- for ( i = 0 ; i < expected . length ; i ++ ) {
908- actual . push ( it . next ( ) ) ;
909- }
910- t . deepEqual ( actual , expected , 'returns expected values' ) ;
911- t . equal ( ctx . count , expected . length - 1 ) ;
912- t . end ( ) ;
913-
914- function transform ( x , y ) {
915- this . count += 1 ; // eslint-disable-line no-invalid-this
916- return x + y ;
917- }
918- } ) ;
919-
920805tape ( 'the returned iterator has a `return` method for closing an iterator (no argument)' , function test ( t ) {
921806 var it ;
922807 var r ;
0 commit comments