@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
14 lines (13 loc) • 579 B
TypeScript
/**
* given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
* if it is unique!
*
* @example
* ```typescript
* findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
* findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
* findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
* findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
* ```
*/
export declare function findByPrefixIfUnique(prefix: string, keys: readonly string[]): string | undefined;