-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update glb-parser #5219
Update glb-parser #5219
Conversation
const process = options && options.camera && options.camera.process || createCamera; | ||
const postprocess = options && options.camera && options.camera.postprocess; | ||
const preprocess = options?.camera?.preprocess; | ||
const process = options?.camera?.process || createCamera; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to standardize on ??
instead of ||
for these kinds of use cases? Which means 'if the left side is null or undefined, use the right side' (rather than a logical op).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah updating to ?? would make sense. I have a followup PR already which is based on this one and will update to ?? there (since some have been removed).
const preprocess = options && options.camera && options.camera.preprocess; | ||
const process = options && options.camera && options.camera.process || createCamera; | ||
const postprocess = options && options.camera && options.camera.postprocess; | ||
const preprocess = options?.camera?.preprocess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should prescribe a set coding style for options objects. In my code, I've been using a default parameter (empty object) for options objects. But, of course, that will allocate on every call potentially. Whereas using ?.
everywhere is a bit more verbose and might transpile to more code via Babel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how that would work here. Could you give a code snippet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you'd still need the second ?.
regardless. TBH, it's not a big deal.
This PR modernises glb-parser.js by converting functions to arrow functions and replacing instances of
options && options.foo && options.foo.bar
withoptions?.foo?.bar
.