liusong1111 / synapse-extension

MIT License
0 stars 0 forks source link

[q] es5 or es6? #2

Open liusong1111 opened 4 years ago

liusong1111 commented 4 years ago

https://github.com/liusong1111/synapse-extension/blob/328abb2da00d949fffaabc9ac63dfedcd484b3b0/tsconfig.json#L2-L19

liusong1111 commented 4 years ago

https://github.com/liusong1111/synapse-extension/blob/328abb2da00d949fffaabc9ac63dfedcd484b3b0/package.json#L89

If target is es6, lots of functions are supported by browser natively, and lodash may be unnecessary. Remove lodash can reduce package size, faster speed, and better code readability.

Refs: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscor

https://caniuse.com/

But remove lodash need more caution to ensure that will not introduce compability issues.

liusong1111 commented 4 years ago

https://github.com/rebase-network/synapse-extension/blob/bb8fc827adca2ab2281480dd068858d1882ccbf4/src/ui/pages/Address/index.tsx#L234

      const contactIndex = _.findIndex(contacts, function (contactItem) {
        return contactItem.address === currentAddress;
      });
      if (contactIndex > -1) {
        setName(contacts[contactIndex].name);
      }