question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Suggestion] Remove Lodash

See original GitHub issue

First of all, the work that you guys are doing is amazing. Very well maintained. Being a library maintainer. One of the major things that is of concern is the library size, specially when it is for a frontend related.

Currently there are 3 places in your entire library, which is using Lodash

1- Checkbox https://github.com/contiamo/operational-ui/blob/67ab23ed89f16e8e92286d0bfeba5cb7b713ed2a/src/Checkbox/Checkbox.tsx#L1 https://github.com/contiamo/operational-ui/blob/67ab23ed89f16e8e92286d0bfeba5cb7b713ed2a/src/Checkbox/Checkbox.tsx#L98

We can generate a unique id, e.g, timestamp.

I think the id, prop behavior shouldn’t be hard coded like this. The use should be exposed to this prop. As to he/she can add the id.

2- Code https://github.com/contiamo/operational-ui/blob/67ab23ed89f16e8e92286d0bfeba5cb7b713ed2a/src/Code/Code.tsx#L1 https://github.com/contiamo/operational-ui/blob/67ab23ed89f16e8e92286d0bfeba5cb7b713ed2a/src/Code/Code.tsx#L175

We can use Array.filter instead of omit.

3- OperationalUI

https://github.com/contiamo/operational-ui/blob/67ab23ed89f16e8e92286d0bfeba5cb7b713ed2a/src/OperationalUI/OperationalUI.tsx#L3 https://github.com/contiamo/operational-ui/blob/67ab23ed89f16e8e92286d0bfeba5cb7b713ed2a/src/OperationalUI/OperationalUI.tsx#L154

Wouldn’t this include the entire library import { Cancelable } from "lodash" ?

Again just 2 cents on my opinion. Going through your code base was fun. Typescript is new to me 😅 Did an hour crash course with .ts before coming to this repo.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
adeelibrcommented, Sep 26, 2018

@peterszerzo can I make a PR to replace lodash omit with the spread syntax?

1reaction
TejasQcommented, Oct 11, 2018

Yes, @adeelibr. PRs are always welcome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I implement the lodash _.remove function in modern ...
Lodash uses Array.prototype.splice at the appropriate position, pushing the removed element onto the result array. Then it decreases the ...
Read more >
Remove lodash dependency from '@wordpress/element'
While lodash itself is small in size, the fact that wp.element depends on it means that any code wanting to enqueue wp.element on...
Read more >
Lodash | _.remove() Method - GeeksforGeeks
The _.remove() method is used to remove all elements from the array that predicate returns True and returns the removed elements. Syntax: _....
Read more >
10 Important Lodash Functions for JavaScript Developers
10 Important Lodash Functions for JavaScript Developers · Clone . . . deeply! · Remove duplicates from an array · Difference of two...
Read more >
13 Methods To Remove/Filter an Item in an Array (and Array of ...
1. pop. “The pop() method removes the last element from an array and returns that element. · 2. shift. “The shift() method removes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found