0.1.1 • Published 6 years ago

dupliname v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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"