Coder Social home page Coder Social logo

Comments (4)

ljharb avatar ljharb commented on August 15, 2024

That's how the vast majority of npm modules work, so while we could certainly add it, I'm not sure it's necessary. Have you found many modules where this isn't the case, and they don't document the divergence explicitly?

from node-extend.

blaise-io avatar blaise-io commented on August 15, 2024

I don't know what the standard practice is, as most npm modules I have worked with so far return an object because they expose multiple functions. Although my expectation matched the implementation, I had to check, so being explicit about it is probably a good idea as there are more inexperienced node users out there that you can save some time.

from node-extend.

ljharb avatar ljharb commented on August 15, 2024

I'd be open to a PR for it - improving docs readability is always a good thing.

The overwhelmingly standard practice is for modules to have a single default export that's a function, and if extra properties are required, stick them on there. Modules that are grab bags of properties on an object tightly couple the requiring code to the implementation, and are discouraged.

from node-extend.

blaise-io avatar blaise-io commented on August 15, 2024

Thanks, that's good to know.

I'll close this issue and open a pull request in a few minutes.

from node-extend.

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.