Open stolsky opened 2 years ago
example from line 105ff
set currentState(id) { if (isNumber(id) && this.#states instanceof Array) { if (id === 0) { this.#current_state = null; } else { this.#current_state = this.#states.find((state) => state.id === id); } } }
better:
setCurrentState(id) { if (isNumber(id) && this.#states instanceof Array) { this.#current_state = this.#states.find((state) => state.id === id) ?? null; } return this; }
Bad code from BaseObject
example from line 105ff
better: