We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol.iterator
Expansion
Currently to iterate over an expander you must call getIterator:
getIterator
const digitExpander = expand(/\d/); for (const digit of digitExpander.getIterator()) { // ... }
By implementing Symbol.iterator, you would be able to do the following:
const digitExpander = expand(/\d/); for (const digit of digitExpander) { // ... }
This can be done by changing the Expansion like so:
export default class Expansion { // ... (omitted) .... /** * Alias for `getIterator` */ public [Symbol.iterator]: () => IterableIterator<string>; // ... (omitted) .... public constructor(getIterator: IterableSource, count: Expansion['count']) { this.getIterator = toIterable(getIterator); this[Symbol.iterator] = this.getIterator; this.count = count; } }
I'd contribute it myself, but I'm not sure how exactly you would like it styled, and would probably end up messing something up, haha. :)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently to iterate over an expander you must call
getIterator
:By implementing
Symbol.iterator
, you would be able to do the following:This can be done by changing the
Expansion
like so:I'd contribute it myself, but I'm not sure how exactly you would like it styled, and would probably end up messing something up, haha. :)
The text was updated successfully, but these errors were encountered: