IdGenerator Class — react Architecture
Architecture documentation for the IdGenerator class in id-generator.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 71b57dae_c8cb_408c_cb18_08606d9778fe["IdGenerator"] f296b15c_8a0c_e363_908f_1324b149f91c["id-generator.js"] 71b57dae_c8cb_408c_cb18_08606d9778fe -->|defined in| f296b15c_8a0c_e363_908f_1324b149f91c 957ef09c_5dd4_7d47_2414_d49f639f3609["constructor()"] 71b57dae_c8cb_408c_cb18_08606d9778fe -->|method| 957ef09c_5dd4_7d47_2414_d49f639f3609 d8273847_852d_f505_f83c_ee0bed325cf2["next()"] 71b57dae_c8cb_408c_cb18_08606d9778fe -->|method| d8273847_852d_f505_f83c_ee0bed325cf2
Relationship Graph
Source Code
packages/eslint-plugin-react-hooks/src/code-path-analysis/id-generator.js lines 12–35
class IdGenerator {
/**
* @param {string} prefix Optional. A prefix of generated ids.
*/
constructor(prefix) {
this.prefix = String(prefix);
this.n = 0;
}
/**
* Generates id.
* @returns {string} A generated id.
*/
next() {
this.n = (1 + this.n) | 0;
/* c8 ignore start */
if (this.n < 0) {
this.n = 1;
} /* c8 ignore stop */
return this.prefix + this.n;
}
}
Source
Frequently Asked Questions
What is the IdGenerator class?
IdGenerator is a class in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/id-generator.js.
Where is IdGenerator defined?
IdGenerator is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/id-generator.js at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free