YuriGor / deepdash

eachDeep, filterDeep, findDeep, someDeep, omitDeep, pickDeep, keysDeep etc.. Tree traversal library written in Underscore/Lodash fashion
https://deepdash.io/
MIT License
274 stars 12 forks source link

ES5 compatibility #28

Closed fgrandval closed 5 years ago

fgrandval commented 5 years ago

Hi, I'm having an issue when building and running on IE11, a project using deepdash 4.2.10. The error comes from getHasChildren.js which use an arrow function and cause a 'SCRIPT1002' error in Internet Explorer 11.

Can you fix this issue ? Thank you !

YuriGor commented 5 years ago

Hi, yes, thank you for report, will fix tomorrow I should also check my eslint settings and run eslint before commit.

YuriGor commented 5 years ago

fixed in v4.2.11

fgrandval commented 5 years ago

Thank you !!

fgrandval commented 5 years ago

Hi @YuriGor, 4.2.11 didn't fix my issue, the problem persists :

Image of arrow error in IE

Image of arrow error in IE

YuriGor commented 5 years ago

Do you use browser build? Latest version? There is no arrow function anymore: https://github.com/YuriGor/deepdash/blob/8343e3c1101a444d30157f4457012d11b765b45f/browser/deepdash.js#L56

YuriGor commented 5 years ago

check if your npm/yarn really upgraded a package if you use it, or make sure you use correct link to CDN also clear browser's cache.

fgrandval commented 5 years ago

I'm importing mapDeep method as standalone ES6 module import mapDeep from 'deepdash/mapDeep';

Build with Angular CLI (webpack) 8.2

YuriGor commented 5 years ago

So you probably need to use babel/bable webpack plugin to make the code compatible with browsers.

fgrandval commented 5 years ago

PR 30 solves the problem

YuriGor commented 5 years ago

No actually, this pr tries to change generated code, and there are several places where es6 used, so all the code need to be changed.

I'll think about to come back to es5 in the sources so no translation will be needed, but this will be not so fast. So please consider to use transpiler for now.

YuriGor commented 5 years ago

@fgrandval I pushed another version with transpiled commonjs build, now it should work for your case. take v.4.2.12

fgrandval commented 5 years ago

It works now ! Thank you @YuriGor

YuriGor commented 5 years ago

Thank you for feedback, @fgrandval, consider to put a star to github project - it will promote the package in npm search :star2: