Skip to content

Commit

Permalink
avoid String#replaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed Mar 28, 2024
1 parent 9822009 commit d44bdac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
module.exports = [
...require('eslint-plugin-mmkal').recommendedFlatConfigs,
{ignores: ['lib/**', 'examples/**', 'test/generated/**']}, //
{
rules: {
// todo[>=4.0.0] drop lower node versions support and remove this
'unicorn/prefer-string-replace-all': 'off', // still supporting node 12 :(
},
},
]
4 changes: 2 additions & 2 deletions src/umzug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ export class Umzug<Ctx extends object = object> extends emittery<UmzugEvents<Ctx
await this.runCommand('create', async ({context}) => {
const isoDate = new Date().toISOString()
const prefixes = {
TIMESTAMP: isoDate.replace(/\.\d{3}Z$/, '').replaceAll(/\W/g, '.'),
DATE: isoDate.split('T')[0].replaceAll(/\W/g, '.'),
TIMESTAMP: isoDate.replace(/\.\d{3}Z$/, '').replace(/\W/g, '.'),
DATE: isoDate.split('T')[0].replace(/\W/g, '.'),
NONE: '',
}
const prefixType = options.prefix ?? 'TIMESTAMP'
Expand Down

0 comments on commit d44bdac

Please sign in to comment.