grepString (function)
Splits the string passed into it on \n and then returns the lines matching
the specified pattern, as an array of strings or detail objects.
@paramstr — The string to search through.@parampattern — The pattern to find. Can be a string or a RegExp.@paramoptions — Options which control matching behavior.
See also grepFile, grepArray, String.prototype.grep, and Array.prototype.grep.
(
str: string,
pattern: string | RegExp,
},
};
grepString(...) (call signature)
grepString(...) (call signature)
grepArray (function)
Returns those Array items matching the specified pattern, as either an Array of items or an Array of detail objects.
@paramtargetArray — The Array of strings to search through. Non-strings will be coerced to string during matching.@parampattern — The pattern to find. Can be a string or a RegExp.@paramoptions — Options which control matching behavior.
See also grepString, grepFile, String.prototype.grep, and Array.prototype.grep.
<T>(
targetArray: Array<T>,
pattern: string | RegExp,
},
<T>(
targetArray: Array<T>,
pattern: string | RegExp,
): Array<T>;
};
grepArray(...) (call signature)
grepArray(...) (call signature)
grepFile (function)
Reads the file content at path, splits it on \n, and then returns the
lines matching the specified pattern, as an array of strings or detail
objects.
@paramstr — The string to search through.@parampattern — The pattern to find. Can be a string or a RegExp.@paramoptions — Options which control matching behavior.
See also grepArray, grepString, String.prototype.grep, and Array.prototype.grep.
(
pattern: string | RegExp,
},
(
pattern: string | RegExp,
): Array<string>;
};
grepFile(...) (call signature)
grepFile(...) (call signature)
String (interface)
interface String {
grep: {
(
pattern: string | RegExp,
},
};
}
String.grep (function property)
Splits the target string on \n and then returns the lines matching the
specified pattern, as an array of strings or detail objects.
@paramstr — The string to search through.@parampattern — The pattern to find. Can be a string or a RegExp.@paramoptions — Options which control matching behavior.
See also grepString, grepArray, grepFile, and Array.prototype.grep.
grep: {
};
String.grep(...) (call signature)
String.grep(...) (call signature)
Array (interface)
interface Array<T> {
grep: {
(
pattern: string | RegExp,
},
};
}
Array.grep (function property)
Returns those Array items matching the specified pattern, as either an Array of items or an Array of detail objects.
@parampattern — The pattern to find. Can be a string or a RegExp.@paramoptions — Options which control matching behavior.
See also grepString, grepArray, grepFile, and String.prototype.grep.
grep: {
};
Array.grep(...) (call signature)
Array.grep(...) (call signature)
GrepOptions (interface)
}
GrepOptions.inverse (boolean property)
When inverse is true, the grep function returns those lines which DON'T
match the pattern, instead of those which do. Defaults to false.
GrepOptions.details (boolean property)
When details is true, the grep function returns an array of
GrepMatchDetail objects instead of an array of strings. Defaults to
false.
GrepMatchDetail (interface)
When grepString, grepArray, grepFile, or String.prototype.grep are
called with the { details: true } option set, an Array of GrepMatchDetail
objects is returned.
}
GrepMatchDetail.lineNumber (number property)
GrepMatchDetail.lineContent (ItemType property)
GrepMatchDetail.matches (RegExpMatchArray property)
GrepMatchDetail.index (number property)
Same as lineNumber - 1.
GrepMatchDetail.content (ItemType property)
Alias for lineContent.