The tool performs deep searches in javascript objects, returning back lists of keys and values for which the search clause will be executed, this is especially useful when debugging. Regular expressions are used under the hood, so you can very flexibly customize your search terms.

Install

npm i object-grep

Arguments

targetObject: [object|array|function|string] - a target object where all keys and property contents will be recursively checked for matching searchExpr

searchExpr: [string|regexp] - expression for checking for compliance

depth limit?: [number] - the number of levels to check. objectGrep works synchronously, which can cause the browser to freeze if the object being checked is very large. The default value is 20

Examples

Inject

You can add it to the object prototype. You can then call the grep method on any object

Revoke

To cancel injection use the revoke method. Calling revoke will return the object prototype to its original form

Chrome extension

You can also install a browser extension and use object-grep on any site without any extra effort