cacheman-file
cacheman-file copied to clipboard
String.replace() works only with the first occurence
The following lines might cause problems in certain cases.
- https://github.com/anaptfox/cacheman-file/blob/8fcf3f8087790b9a0830d37951c06c991cc286a2/index.js#L20
- https://github.com/anaptfox/cacheman-file/blob/8fcf3f8087790b9a0830d37951c06c991cc286a2/index.js#L35
- https://github.com/anaptfox/cacheman-file/blob/8fcf3f8087790b9a0830d37951c06c991cc286a2/index.js#L93
- https://github.com/anaptfox/cacheman-file/blob/8fcf3f8087790b9a0830d37951c06c991cc286a2/index.js#L112
file = file.replace('.json', '').replace('_', ':');
file = file.replace(/\.json$/, '').replace(/_/g, ':');
Other widely used pattern is 'foo:foo'.split('foo').join('bar'); // bar:bar