scope-reporter
traks scope identifiers during processing
API
Table of Contents
- createScopeDefinitions
- createScopeDefinition
- commonScopes
- createConsoleAdapter
- createLoggingAdapter
- createReporter
- rootObject
- scopeDefinitions
- scopeStack
- currentScope
createScopeDefinitions
Creates several scope definition from a given json hash.
Parameters
scopes
Object
createScopeDefinition
Creates a scope definition
Parameters
name
string the scope definition nameproperties
Object describung properties for the scopeformat
format string for the scope properties
commonScopes
Commonly used scopes
createConsoleAdapter
Creates a reporting adaptor for console api.
Parameters
aConsole
Object console object may be undefined for the default console (optional, defaultconsole
)
Returns any the newly created adaptor
createLoggingAdapter
Creates a reporting adaptor for logging api.
Parameters
logger
target logger
Returns any the newly created adaptor
createReporter
Creates a new scope reporter.
Parameters
scopeDefinitionsRaw
ObjectreportAdapter
Returns ScopeReporter newly created scope reporter
rootObject
methods of all scopes
toJSON
Delivers the json representation of the scope-reporter.
Returns Object with scopes array
addScopeDefinitions
Add additional scope definitions
Parameters
defs
new scope defintions to be added to the already present ones
scope
Deliver a scope for a given scope name.
Parameters
name
string name of the scope
Returns Object for the given name
enterScope
Enter a new scope by pushing the scope to the scope stack.
Parameters
scope
name of the scope to be enteredpropertiesOrScalar
the properties of the new scope may ge a scalar if there is only one possible property
Returns any newly created scope with the assigned properties.
leaveScope
Leaves the last entered scope.
Parameters
-
expectedScope
the expected current scope may be undefined -
Throws any if expectedScope is not the current scope
Returns any the old leaved scope
clearScopes
Clears the scope stack
scopeDefinitions
Delivers the scope definitions
Returns any scope defintions
scopeStack
Delivers the scope stack.
Returns any scope stack
currentScope
Delivers the current scope
Returns any the current scope
install
With npm do:
npm install scope-reporter
license
BSD-2-Clause