A range function for JavaScript, designed the same way as Python's. Works using ES6 generators.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The prototype for all Generator objects | |
* (the type returned from all `function*` functions). | |
* Can be used to define additional methods for generators | |
* using `Object.defineProperty` or `Object.defineProperties` | |
* @type {Generator<never, never, never>} | |
*/ | |
const generatorProto = Object.getPrototypeOf( | |
Object.getPrototypeOf((function* () {})()), | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Apache License | |
Version 2.0, January 2004 | |
http://www.apache.org/licenses/ | |
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
1. Definitions. | |
"License" shall mean the terms and conditions for use, reproduction, | |
and distribution as defined by Sections 1 through 9 of this document. |