Closed ErezBiren closed 1 year ago
Would be more clear to use another line to express the nested operation as a separate statement.
export function queryScrollBody(root: NullableElement): NullableElement { return root ? root.matches(asSelectors(ClassNames.scrollBody)) ? root : root.querySelector(asSelectors(ClassNames.scrollBody)) : null; }
Maybe somethig like this.
export function queryScrollBody(root: NullableElement): NullableElement { if (!root) return null; return root.matches(asSelectors(ClassNames.scrollBody)) ? root : root.querySelector(asSelectors(ClassNames.scrollBody)); }
If you want I can PR it.
I agree. Brevity is not a good enough excuse. I wrote the entire codebase in a month or two, so I just did it the way it was fastest to me at that moment.
I think your proposal is more readable.
Would be more clear to use another line to express the nested operation as a separate statement.
Maybe somethig like this.
If you want I can PR it.