Skip to content

min9nim/get-new-name

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

get-new-name

getNewName is a function that return unique numbered name from names array.


Install

npm i get-new-name

How to use

import getNewName from 'get-new-name'

getNewName('abc', ['abc', 'abc(2)'])    // You will get 'abc(3)' as a newName
getNewName('abc', ['abc', 'abc(2)', 'abc(3)'])    // You'll get 'abc(4)'
getNewName('abc', ['abc', 'abc2', 'abc3'])    // You'll get 'abc(2)'
getNewName('abc', ['abc2', 'abc3'])    // You'll get 'abc'

About

You will get unique new name from names array

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published