We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec0c207 commit 46cb832Copy full SHA for 46cb832
src/base/drop.js
@@ -15,16 +15,15 @@ import { tail } from './tail' ;
15
* @param {Number} n - The number of elements to drop.
16
* @returns {Iterator}
17
*/
18
-export function drop ( iterable , n ) {
+export function* drop ( iterable , n ) {
19
20
- if ( n < 0 ) return tail( iterable , -n ) ;
+ if ( n < 0 ) {
21
+ yield* tail( iterable , -n ) ;
22
+ return ;
23
+ }
24
- return ( function* ( ) {
-
- const iterator = iter( iterable ) ;
25
- consume( iterator , n ) ;
26
- yield* iterator ;
27
28
- } )( ) ;
+ const iterator = iter( iterable ) ;
+ consume( iterator , n ) ;
+ yield* iterator ;
29
30
}
0 commit comments