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

Replace lodash 'isPlainObject' usage with is-plain-obj library #11859

Closed
wants to merge 5 commits into from
Closed

Replace lodash 'isPlainObject' usage with is-plain-obj library #11859

wants to merge 5 commits into from

Conversation

jayaddison
Copy link
Contributor

@jayaddison jayaddison commented Jul 21, 2020

Q                       A
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? No
Any Dependency Changes? Yes
License MIT

This is an alternative to #11855. What's the best selection between two libraries? There are often n different factors to weigh up.

Some considerations here are:

  • Popularity is comparable between is-plain-object and is-plain-obj
  • is-plain-obj appears to have aimed towards compatibility with lodash in the past, and has had a stable release under that basis for a longer period of time
  • is-plain-obj has a smaller unpacked size
  • Test coverage appears broadly similar between the two; is-plain-obj may test more scenarios while is-plain-object provides in-browser-environment test coverage

Rather than attempt to sway a decision by offering only a single pull request it might be safest to open two and allow discussion.

In retrospect it might've been worth more fully exploring and evaluating the options available during a previous thread.

@babel-bot
Copy link
Collaborator

babel-bot commented Jul 21, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/32348/

@jayaddison jayaddison marked this pull request as draft July 21, 2020 10:38
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 21, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 460aacc:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@jayaddison
Copy link
Contributor Author

(switching to draft because I'm not sure what factors should determine the approach between this and #11855)

@TrySound
Copy link
Contributor

@jayaddison
Copy link
Contributor Author

is-plain-obj requires node 8

That's a good consideration. Honestly I don't feel well-experienced enough with the JS dependency ecosystem or babel's roadmap to determine what to do at the moment, so I'll step back for a bit!

@jayaddison jayaddison changed the base branch from main to next-8-dev September 3, 2020 16:15
@jayaddison
Copy link
Contributor Author

After taking some time away from this and reconsidering, I think the approach I'd suggest to replace isPlainObject is to use is-plain-obj as proposed here in #11859, instead of is-plain-object as proposed in #11855.

It might seem a tiny and arbitrary choice, but I don't love the fact that in #11855 the external dependency had to be updated to match the application's use case (but thanks @TrySound for discovering and applying that change upstream, which should benefit other users). That seems to indicate (to me at least) that there's less stability in the interface and behaviour of the is-plain-object library -- and that might be fine in some cases, but for a single-purpose library function it does raise some questions. By contrast, is-plain-obj seems to prefer stability and avoidance of unnecessary releases, and core ownership and authorship of the library seem stronger based on the library's commit and merge history.

The main downside to the is-plain-obj approach is the required upgrade to Node 8 or later. A counter-argument to that is that we're already on track to require a Babel 8 release (and therefore Node >= 10) before dropping lodash completely due to #11842.

@jayaddison jayaddison marked this pull request as ready for review September 3, 2020 16:45
@jayaddison jayaddison closed this Jan 29, 2021
@jayaddison jayaddison deleted the dependencies/reduce-lodash-usage-isplainobj branch January 29, 2021 18:34
@jayaddison
Copy link
Contributor Author

(closing and cleaning up a few stale pull requests; see #11789 (comment) and subsequent comments in case it's useful to re-open from github pr refs at a later date)

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Dependency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants