mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
16 lines
215 B
JavaScript
16 lines
215 B
JavaScript
export class Counter {
|
|
constructor(start) {
|
|
this.n = start;
|
|
}
|
|
inc(by) {
|
|
this.n += by;
|
|
return this;
|
|
}
|
|
value() {
|
|
return this.n;
|
|
}
|
|
label(prefix) {
|
|
return `${prefix}<${this.n}>`;
|
|
}
|
|
}
|