Skip to content
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

Rid of lodash #12

Merged
merged 8 commits into from Feb 4, 2020
Merged

Rid of lodash #12

merged 8 commits into from Feb 4, 2020

Conversation

ufocoder
Copy link
Contributor

@ufocoder ufocoder commented Feb 2, 2020

#11

@ir4y
Copy link
Member

ir4y commented Feb 3, 2020

@ruscoder @m0rl
Please elaborate, add a set of lodash functions you use in daily tasks.
We need to backport it via native primitives.

@dmitryashutov
Copy link
Member

dmitryashutov commented Feb 3, 2020

I use often:
map, isEmpty, flatMap, chain, flatten, flattenDeep, filter, find, reduce, compact

services/instance.ts Outdated Show resolved Hide resolved
services/fhir.ts Outdated Show resolved Hide resolved
services/fhir.ts Outdated Show resolved Hide resolved
services/fhir.ts Outdated Show resolved Hide resolved
hooks/pager.ts Outdated Show resolved Hide resolved
@ruscoder
Copy link
Member

ruscoder commented Feb 4, 2020

@ruscoder @m0rl
Please elaborate, add a set of lodash functions you use in daily tasks.
We need to backport it via native primitives.

I'm not sure that we need to do it in this way:

  1. A lot of lodash functions can be useful
  2. Native primitives worked not so fast in comparison to lodash alternatives (a year ago, now - I don't know)
  3. We can override type definitions for some lodash functions we use
  4. Let's do it in another way, as we discussed with @dymio yesterday.

Proposed solution (project related! not aidbox-react package):

  1. Create file src/utils/lodash.ts (for example)
  2. Import the particular lodash functions using the function package, e.g. import map from 'lodash/map';
  3. Export them

And use in the project in the following way:

import * as _ from 'src/utils/lodash';

_.map()

It will reduce the bundle size, and we can easily add new lodash function to the project.

@ir4y What do you think?

@@ -308,6 +308,8 @@ describe('Service `fhir`', () => {
extraField: true,
})
).toBeFalsy();

expect(isReference({} as any)).toBeTruthy();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be false

@ruscoder ruscoder merged commit 4e7020c into beda-software:master Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants