sindresorhus / filenamify

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

Add option to avoid removing repeated replacement #18

Closed rocktimsaikia closed 3 years ago

rocktimsaikia commented 4 years ago

Feature of avoid removing repeated replacement added suggested by the issue #10.

A new option is now available named 'condenseReplacements' as suggested by @sindresorhus on issue #10

filenamify('/path/to/file---name.ext"', {replacement: '-', condenseReplacements: true});
// => path-to-file---name.ext

Test case added along with updated README

// @sindresorhus

Fixes #10

sindresorhus commented 4 years ago

The default value should be true, to preserve existing behavior.

rocktimsaikia commented 4 years ago

The default value should be true, to preserve existing behavior.

@sindresorhus Ah, I see. This would be a breaking change then! That's why I hesitated to set it true by default.

papb commented 4 years ago

@RocktimSaikia No; the default value being true is exactly what makes it not a breaking change.

sindresorhus commented 3 years ago

Bump