dupliname
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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"

Readme

Keywords

Package Sidebar

Install

npm i dupliname

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

2.77 kB

Total Files

5

Last publish

Collaborators

  • ukyo