You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for the rapid fire comments, needed to get it out before jumping into a meeting and forgetting.
Continuing the feedback from #28.
There are a couple of methods that are sufficiently complicated and don't have a direct equivalent so instead we have a custom-built copy of lodash containing only those specific methods. You can find this file at: third_party/javascript-khansrc/lodash/lodash.js along with instructions on how to build it and exactly what methods are included.
In addition, Lodash is totallymodular & works great with browserify / webpack to create smaller bundles. There's even a babel plugin to avoid mucking with module paths.
It would be better to compare to _.assign as that's closer to Object.assign
(iterating only own properties of source values instead of own+inherited in _.extend).
for (const [key, val] of Object.entries(obj)) {} | _.each(obj, fn)
In Lodash there's _.forOwn and _.forIn for object iteration too
The useful bit for _.defer and _.delay is they allow partially applying arguments to the deferred/delayed function, which older environments lacked in setTimeout (may be worth noting).
Thank you for your very thorough feedback! I'll let John (Resig) speak to the particulars, since he's a lot more familiar with the technical domain than I am.
One thing that may help put this chart in context: it's intended for Khan Academy employees when writing/modernizing KA code. So the "instead of" table refers to underscore constructs that are actually used in KA code. It's not meant to be an exhaustive list of all functions that exist in underscore or lodash.
One thing that may help put this chart in context: it's intended for Khan Academy employees when writing/modernizing KA code.
Yep, that's cool. Most of my comments can be seen as just adding extra info. Besides the typos or incorrect usage the rest can be taken as is (no pressure to change bits) but if something is considered notable then by all means note it up :)
Sorry for the rapid fire comments, needed to get it out before jumping into a meeting and forgetting.
Continuing the feedback from #28.
In addition, Lodash is totally modular & works great with browserify / webpack to create smaller bundles. There's even a babel plugin to avoid mucking with module paths.
It would be better to compare to
_.assign
as that's closer toObject.assign
(iterating only own properties of source values instead of own+inherited in
_.extend
).In Lodash there's
_.forOwn
and_.forIn
for object iteration tooThe useful bit for
_.defer
and_.delay
is they allow partially applying arguments to the deferred/delayed function, which older environments lacked insetTimeout
(may be worth noting).Typo, fix to
obj.method = obj.method.bind(obj);
This will assign
_initDone
to the outerthis
so not really appropriate for per method state.The text was updated successfully, but these errors were encountered: