spotlight
spotlight.byKind
spotlight.byName
spotlight.byValue
spotlight.custom
spotlight.debug
spotlight.runInContext
spotlight.version
(Object): The primary namespace.
Crawls environment objects logging all object properties whose values
are of a specified constructor instance, [[Class]]
, or type.
kind
(Function|string): The constructor,[[Class]]
, or type to check against.[options={}]
(Object): The options object.
// by constructor
spotlight.byKind(jQuery);
// or by `[[Class]]`
spotlight.byKind('RegExp');
// or by type
spotlight.byKind('undefined');
// or special kind "constructor"
spotlight.byKind('constructor');
Crawls environment objects logging all object properties of the specified name.
name
(string): The property name to search for.[options={}]
(Object): The options object.
// basic
spotlight.byName('length');
// => window.length -> (number) 0
// or with options
// (finds all "map" properties on jQuery)
spotlight.byName('map', { 'object': jQuery, 'path': '$' });
// => $.map -> (function) function(a,b,c){...}
// => $.fn.map -> (function) function(a){...}
Crawls environment objects logging all object properties whose values are
a match for the specified value, using SameValueZero
for equality comparisons.
Note: SameValueZero
is like strict equality, e.g. ===
, except that
NaN
matches NaN
. See the ES6 spec
for more details.
value
(*): The value to search for.[options={}]
(Object): The options object.
// basic
spotlight.byValue(0);
// => window.pageXOffset -> (number) 0
// => window.screenX -> (number) 0
// => window.length -> (number) 0
Crawls environment objects executing callback
, passing the current
value
, key
, and object
as arguments, against each object encountered
and logs properties for which callback
returns true.
callback
(Function): A function executed per object.[options={}]
(Object): The options object.
// filter by property names containing "oo"
spotlight.custom(function(value, key) { return key.indexOf('oo') > -1; });
// or filter by falsey values
spotlight.custom(function(value) { return !value; });
This function enables or disables debug mode for all spotlight
methods.
value
(boolean): The flag value.
spotlight.debug(true);
spotlight.byName('length');
// => [['window.length -> (number)', 0]]
Create a new spotlight
object using the given context
object.
[context=root]
(Object): The context object.
(Object): Returns a new spotlight
object.
(string): The semantic version number.