Skip to content

Commit

Permalink
Target ES2015
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Sep 26, 2024
1 parent 51dbd45 commit 5969033
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,22 @@ function* lexer(str: string): Generator<LexToken, LexToken> {
}

class Iter {
#peek?: LexToken;
private _peek?: LexToken;

constructor(private tokens: Generator<LexToken, LexToken>) {}

peek(): LexToken {
if (!this.#peek) {
if (!this._peek) {
const next = this.tokens.next();
this.#peek = next.value;
this._peek = next.value;
}
return this.#peek;
return this._peek;
}

tryConsume(type: TokenType): string | undefined {
const token = this.peek();
if (token.type !== type) return;
this.#peek = undefined; // Reset after consumed.
this._peek = undefined; // Reset after consumed.
return token.value;
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "@borderless/ts-scripts/configs/tsconfig.json",
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"target": "ES2015",
"lib": ["ES2015"],
"rootDir": "src",
"outDir": "dist",
"module": "NodeNext",
Expand Down

0 comments on commit 5969033

Please sign in to comment.