Turn function into arrow function - #32
Conversation
I also noticed that if we use exportdefault(obj,path,def,undef)=>{path=path.split ? path.split(".") : path;path.some(key=>!(obj=obj ? obj[key] : undef));returnobj===undef ? def : obj;};exportdefault((a,b,c,d)=>(b=b.split?b.split("."):b,b.some(b=>!(a=a?a[b]:d)),a===d?c:a));Then again, maybe is a performance thing. |
RReverser
commented
May 23, 2019
Hmm, did you use |
@RReverser maybe making a PR to microbundle so the "module" build preserves the ES6 syntax instead of turning it into ES5? Also, even using microbundle, the other option I mentioned in #32 (comment) has a smaller size: exportdefaultfunction(t,n,e,r){return(n=n.split?n.split("."):n).some(function(n){return!(t=t?t[n]:r)}),t===r?e:t}And if you have and object like |
developit
commented
Jul 29, 2019
This library targets IE9+, so we can't rely on |
loucyx
commented
Jul 29, 2019
Sorry @developit, I never take IE into consideration. My bad! .... Closing then! |
Using an arrow function instead of a function the source is smaller, and also the minified code:
I'll understand if there is a reason related to performance or similar to not use an arrow function, but I'm making a PR if you consider this to be a good change 😄