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

Move to ESM #83

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

tommy-mitchell
Copy link

@tommy-mitchell tommy-mitchell commented Aug 21, 2023

Per #82.

  • Converts project from CJS to ESM.
  • Uses Object.hasOwn() instead of Object.prototype.hasOwnProperty.call()
  • Updates code style to use xo (based on configs from AVA)
  • Updates dependencies (except for well-known-symbols)
  • Includes a build of lodash with only the required functions
    • Removes _.flattenDeep in favor of Array#flat(Infinity)

A few tests are failing, seems to have to do with serialization and object pointers.

@tommy-mitchell tommy-mitchell mentioned this pull request Aug 21, 2023
6 tasks
@tommy-mitchell
Copy link
Author

Perhaps we could use smoldash instead of lodash for _.cloneDeep and _.merge: https://github.com/marvinhagemeister/smoldash/blob/51b5872d8c0887e25e0ccd54555b35f0d7ecb2a8/src/index.ts#L286-L339

Related, what is _.isLength doing? Is it needed?

@novemberborn
Copy link
Member

  • Updates dependencies (except for well-known-symbols)

That library has transferred actually (not sure if it's been republished yet). There's definitely more well-known symbols out there but maybe there's a better way to encode them.

Perhaps we could use smoldash instead of lodash for _.cloneDeep and _.merge: marvinhagemeister/smoldash@51b5872/src/index.ts#L286-L339

I'm not bothered either way. There may also be some APIs we could use, e.g. the structured clone implementation in the node:v8 module.

Related, what is _.isLength doing? Is it needed?

Looks like it's a heuristic for identifying when to treat an object as a list (array). But it could be inlined:

https://github.com/lodash/lodash/blob/ddfd9b11a0126db2302cb70ec9973b66baec0975/lodash.js#L11713-L11716

I'd go with 18. 16 is end of life in 9 days.

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

2 participants