wsearch

3.1.1 • Public • Published

wsearch

Function to search values (or keys) in objects by RegExp.

Installation

  • from package manager
npm i wsearch

and import into your file:

const wsearch = require('wsearch');
//or
import wsearch from 'wsearch';
  • from browser DevTools
Put code from "wsearch.min.js" to the target page console.

Basic usage

wsearch(query, {target}[, options])

Nesting target in the object with a single property is required for valid path in output.

Default search prototypes: ["Window", "Object", "Array", "Set", "Map", "Function"]

  • query <RegExp> Search query
  • target <Object> | <Array> | etc. Object with any prototype to search
  • options <Object>
    • byKeys <boolean> Default: false

      Change the mode to search by property names.

    • functions <boolean> Default: false

      Add functions body to search.

    • typesAdd <Array>

      Add prototypes to defaults (like "Location", "Navigator" etc.). You can get type of any object:

       Object.prototype.toString.call(object);
    • typesSet <Array> | "all"

      Replace defaults prototypes.

      With parameter "all" search will be performed in all prototypes in target object that are found and maybe will take a lot of time.

  • Returns: <Array>

For example:

wsearch(/Hello\sworld/, {window}, {functions: true});

Output:

[
	{
		path: <string path to value>,
		match: <array of matches>,
		object: <object>,
		key: <key>,
		value: <value>
	},
	...
]

Info

If the found path includes Map/Set object or Symbol, access to the keys will be performed through an array with index valid at the time of the search.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.1.10latest

Version History

VersionDownloads (Last 7 Days)Published
3.1.10
3.1.00
3.0.00
2.0.130
2.0.120
2.0.110
2.0.100
2.0.90
2.0.80
2.0.70
2.0.60
2.0.50
2.0.40
2.0.30
2.0.20
2.0.10
2.0.00
1.1.130
1.1.120
1.1.110
1.1.100
1.1.90
1.1.80
1.1.70
1.1.60
1.1.50
1.1.40
1.1.30
1.1.20
1.1.10
1.1.00
1.0.240
1.0.230
1.0.221
1.0.210
1.0.200
1.0.190
1.0.180
1.0.171
1.0.160
1.0.150
1.0.140
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i wsearch

Weekly Downloads

2

Version

3.1.1

License

ISC

Unpacked Size

11 kB

Total Files

4

Last publish

Collaborators

  • martini-drinker