dupliname
v0.1.1
Published
duplicate name
Downloads
1
Readme
dupliname
Duplicate a name.
Install
$ npm install --save dupliname
$ yarn add dupliname
Usage
Simple usage.
import { dupliname } from "dupliname";
const duplicated = dupliname("hello", ["hello", "world"]); // "hello (1)"
Use a custom decorator.
const duplicated = dupliname("hello.txt", ["hello.txt"], (source, index) => {
const body = source.split(".");
const ext = body.pop();
return `${body.join(".")} - Copy ${index}.${ext}`;
}); // "hello - Copy 1.txt"