get-new-name
v0.0.7
Published
Get unique new name from names array
Downloads
7
Maintainers
Readme
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'