Skip to main content

Enumerator class

📖 Description

The Enumerator class implements an automatic increment counter.

👩‍💻 Example

import { Enumerator } from "@tripetto/runner";

console.log(Enumerator.n); // Outputs 1
console.log(Enumerator.n); // Outputs 2

const enumerator = new Enumerator();

console.log(enumerator.n); // Outputs 1
console.log(enumerator.n); // Outputs 2

🆕 constructor

Creates a new Enumerator instance.

Signature

constructor(): Enumerator

Return value

Returns a reference to the new Enumerator instance.

📌 Statics


🏷️ n

Retrieves the next global enumerator (starting with 1).

Type

number


🔧 recycle

Recycles the global enumerator so it begins again at 1.

Signature

recycle(): void

🗃️ Fields


🏷️ n

Retrieves the next instance enumerator (starting with 1).

Type

number

▶️ Methods


🔧 recycle

Recycles the instance enumerator so it begins again at 1.

Signature

recycle(): void