Skip to content

Commit

Permalink
Add next function
Browse files Browse the repository at this point in the history
Added next function to imitate actual generators
  • Loading branch information
Xander1233 committed Aug 12, 2021
1 parent fc5a79c commit 4c5da84
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ class SnowflakeGenerator {
* @return {string}
*/
get id() {
return this.next();
}

/**
* Get a new generated snowflake as a string. Kinda like generators in javascript
* @return {string}
*/
next() {
return this.generate().toString();
}

Expand Down

0 comments on commit 4c5da84

Please sign in to comment.