soiz1's picture
Upload 811 files
30c32c8 verified
raw
history blame
454 Bytes
class VariablePool {
/**
* @param {string} prefix The prefix at the start of the variable name.
*/
constructor (prefix) {
if (prefix.trim().length === 0) {
throw new Error('prefix cannot be empty');
}
this.prefix = prefix;
/**
* @private
*/
this.count = 0;
}
next () {
return `${this.prefix}${this.count++}`;
}
}
module.exports = VariablePool;