Skip to content

Commit be67a7b

Browse files
committed
Add hasChanged method to Env
1 parent 732911a commit be67a7b

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

lib/entry-points.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/environment.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,17 @@ export class ReadOnlyEnv<T extends string | undefined = string | undefined> {
239239
export class Env<
240240
T extends string | undefined = string | undefined,
241241
> extends ReadOnlyEnv<T> {
242+
private changed: boolean = false;
243+
242244
/** Sets an environment variable. */
243245
public set(name: string, value: T): void {
244246
this.vars[name] = value;
247+
this.changed = true;
248+
}
249+
250+
/** Gets a value indicating whether `set` was called at least once. */
251+
public hasChanged(): boolean {
252+
return this.changed;
245253
}
246254
}
247255

0 commit comments

Comments
 (0)