Skip to content

Commit

Permalink
Fix usage example (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine authored Mar 25, 2022
1 parent 3d48279 commit 9a018fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export interface Options {
const prefixIncrementer = (filename, extension) => {
const match = filename.match(/^(?<index>\d+)_(?<originalFilename>.*)$/);
let {originalFilename, index} = match ? match.groups : {originalFilename: filename, index: 0};
let originalFilename = originalFilename.trim();
return [`${originalFilename}${extension}`, `${++index}_${originalFilename}${extension}`;
originalFilename = originalFilename.trim();
return [`${originalFilename}${extension}`, `${++index}_${originalFilename}${extension}`];
};
console.log(await unusedFilename('rainbow.txt', {incrementer: prefixIncrementer}));
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ import {unusedFilename} from 'unused-filename';
const prefixIncrementer = (filename, extension) => {
const match = filename.match(/^(?<index>\d+)_(?<originalFilename>.*)$/);
let {originalFilename, index} = match ? match.groups : {originalFilename: filename, index: 0};
let originalFilename = originalFilename.trim();
return [`${originalFilename}${extension}`, `${++index}_${originalFilename}${extension}`;
originalFilename = originalFilename.trim();
return [`${originalFilename}${extension}`, `${++index}_${originalFilename}${extension}`];
};

console.log(await unusedFilename('rainbow.txt', {incrementer: prefixIncrementer}));
Expand Down

0 comments on commit 9a018fc

Please sign in to comment.