hughsk / clamp

Clamp a value between two other values.
MIT License
39 stars 5 forks source link

Add exports.default - for es6 modules compatibility #7

Open radubrehar opened 8 years ago

radubrehar commented 8 years ago

First 2 lines would be:

exports.default = clamp
module.exports = clamp

So people can import it like import clamp from 'clamp'

radubrehar commented 8 years ago

Not mandatory for tools like webpack, since they know how to handle the import even if module.exports alone is used in the module, but would be a nice addition anyway :)

mreinstein commented 5 years ago

@hughsk would you accept a PR for this? I'd be happy to submit.

mreinstein commented 4 years ago

We should just switch to es modules since it's a standard now.

rocktimsaikia commented 1 month ago

Recently created a clamp lib with ES module support for use in some personal projects. Sharing it here just in case anyone finds it useful: https://github.com/rocktimsaikia/clamp-v2

mreinstein commented 1 month ago

It would have been nice to work on getting clamp updated in npm instead of clogging the ecosystem with another dupe module.

rocktimsaikia commented 1 month ago

Yeah true but since it does not seem to be active anymore, just created an updated version with ESM and type support.