max-by-last-number
v1.2.0
Published
Check array of items and return the item with the highest suffix number. if non is found return undefined.
Downloads
3
Maintainers
Keywords
Readme
maxByLastNumber
Check array of items and return the item with the highest suffix number. if non is found return undefined.
Usage: maxByLastNumber(prefix: string, items: { [key: string]: any; }[] | string[], by?: string | number): string
import { maxByLastNumber } from 'max-by-last-number'
maxByLastNumber('name', ['name1', 'name2', 'otherName'])
// Output: "name2"
maxByLastNumber('dexter', [{ nickname: 'dexter3' }, { nickname: 'dexter2' }], 'nickname')
// Output: "dexter3"
This module exported from utilizes project.