sindresorhus / filenamify

Convert a string to a valid safe filename
MIT License
489 stars 26 forks source link

Provide a browser-only export #17

Closed marcelgerber closed 4 years ago

marcelgerber commented 4 years ago

Fixes #16.

This splits up the code into filenamify.js and filenamify-path.js, where index.js imports both and provides the export as it is today, so this should not be a breaking change.

The user can now also import just filenamify/filenamify (can think about a better name maybe) to only get the browser-ready implementation that doesn't rely on Node's path.

Nothing has changed code-wise, I've just moved things around.

sindresorhus commented 4 years ago

Can you just mention the browser sub-export using a sentence in the readme? I don't think anyone would discover otherwise.

marcelgerber commented 4 years ago

Just added that note 👍

sindresorhus commented 4 years ago

One last thing, you need to update the files property in package.json.

marcelgerber commented 4 years ago

Ah, sorry about that. I've never actually published a npm package myself, so I didn't know exactly what that property was for (or how to test if everything works properly!)

sindresorhus commented 4 years ago

(or how to test if everything works properly!)

https://github.com/sindresorhus/np/pull/456 will help with this when merged. And https://github.com/sindresorhus/np/issues/82 even more so.