UNPKG

@freik/node-utils

Version:

My personal set of utilities for NodeJS

27 lines (26 loc) 1.37 kB
export type StringWatcher = { (str: string): boolean; addToIgnoreList(this: StringWatcher, ...types: (string | Iterable<string>)[]): StringWatcher; addToWatchList(this: StringWatcher, ...types: (string | Iterable<string>)[]): StringWatcher; watching(type: string): boolean; }; /** * Returns a data structure designed to let you opt in, or opt out, of specific * strings. Use `addToWatchList` to "opt in", and use `addToIgnoreList` to opt * out. These two combine (and preempt eachother). If you only have an ignore * list, `watching(str)` will return `true` for everything not on the list. If * you only have a watch list, `watching(str)` will return `false` for * everything not on the list. * @returns StringWatcher */ export declare function MakeStringWatcher(...maybeWatchList: string[]): StringWatcher; /** * Returns a data structure designed to let you opt in, or opt out, of specific * strings. Use `addToWatchList` to "opt in", and use `addToIgnoreList` to opt * out. These two combine (and preempt eachother). If you only have an ignore * list, `watching(str)` will return `true` for everything not on the list. If * you only have a watch list, `watching(str)` will return `false` for * everything not on the list. * @returns StringWatcher */ export declare function MakeSuffixWatcher(...maybeWatchList: string[]): StringWatcher;