GithubHelp home page GithubHelp logo

Comments (8)

sindresorhus avatar sindresorhus commented on May 22, 2024 1

Would there be some benefits to expose the replacement function as a named export instead of default export?

I don't know. Would there be? You're the one asking.

from figures.

sindresorhus avatar sindresorhus commented on May 22, 2024 1

Just to make sure, are you suggesting the following: moving the function to a named export called replaceSymbols(), and keep the default export, but only for the figures (not for that function)?

Correct.

Actually, I think we can just move to ESM. My big ESM is in a month, but we can start early. I have a lot of modules to go through. Since we're doing a breaking release anyway.

from figures.

sindresorhus avatar sindresorhus commented on May 22, 2024 1

Are there some PRs from your other repositories I could use as example? This would streamline both the implementation and the review.

sindresorhus/manage-wifi@89dfe25

sindresorhus/debounce-fn@e07dc3f

from figures.

ehmicky avatar ehmicky commented on May 22, 2024

In my opinion, having a variable that is both a function and a "traditional" object might have some drawbacks:

  • This can be confusing for some users.
  • It can come with some surprise if the user is checking for the variable type (for example with is-plain-obj)
  • This can lead to some unexpected behavior when copying the variable. For example {...var} would keep the object properties, but not the function, while var.bind() would do the opposite.
  • This can complicate TypeScript types.

On the other side, some users find default exports simpler than named exports.

Overall, I think using a named export is more proper, but I was curious what your thoughts on this were?

from figures.

sindresorhus avatar sindresorhus commented on May 22, 2024

Even if we moved the replacement function to a named function, the rest should still stay a default export (I will move to ESM soon, so having both will not be a problem).

I don't feel strongly about this. Any suggestion on the name for the replacement function? replaceSymbols()?

from figures.

ehmicky avatar ehmicky commented on May 22, 2024

replaceSymbols() sounds good 👍

Just to make sure, are you suggesting the following: moving the function to a named export called replaceSymbols(), and keep the default export, but only for the figures (not for that function)?

from figures.

ehmicky avatar ehmicky commented on May 22, 2024

Sounds good.

Are there some PRs from your other repositories I could use as example? This would streamline both the implementation and the review.

from figures.

ehmicky avatar ehmicky commented on May 22, 2024

This was released in https://github.com/sindresorhus/figures/releases/tag/v4.0.0.

from figures.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.