Module: eva

eva

Functions to create and call functions and evaluate expressions.

Source:

Methods

<static> closure(action, paramList, context, settings) → {function}

Create function that executes specified function with given parameters and context and returns result of call.

Parameters:
Name Type Argument Description
action function

Target function that will be executed when created function is called.

paramList Array <optional>

Parameters that should be passed into the target function specified in action argument.

context Object <optional>

Object that will be used as this value when calling the target function specified in action argument. Default value is null.

settings Object <optional>

Operation settings. Keys are settings names, values are corresponding settings values. The following settings are supported:

  • ignoreArgs: Boolean - Whether arguments passed into the created function should be ignored. Default value is false and means that arguments will be included in parameters list for the target function depending of the value of prependArgs setting.
  • prependArgs: Boolean - Whether arguments passed into the created function should be passed into the target function before parameters specified in paramList argument. Default value is false and means that parameters list for the target function will contain values from paramList argument followed by arguments passed into the created function (this is similar to Function.prototype.bind behavior).
Source:
Returns:

Created function.

Type
function

<static> createDelegateMethod(delegate, sMethod, settings) → {function}

Create function that executes specified method of the given object.

Parameters:
Name Type Argument Description
delegate Object

Object whose method will be executed when created function is called.

sMethod String

Name of method that will be executed.

settings Object <optional>

Operation settings. Keys are settings names, values are corresponding settings values. The following settings are supported:

  • destination: Object - target object into which the method will be added that should be used to access the created function
  • destinationMethod: String - name of method of the target object that will be used to access the created function; the value of sMethod parameter by default
Source:
Returns:

Created function.

Type
function

<static> createFunction(sCode, settings) → {function}

Create function to further use.

Parameters:
Name Type Argument Description
sCode String

Function's code.

settings Object <optional>

Operation settings. Keys are settings names, values are corresponding settings values. The following settings are supported (setting's default value is specified in parentheses):

  • expression: Boolean (false) - specifies whether function's code is an expression; when true value is specified, return statement is added at the beginning of function's code
  • paramNames: String ('') - specifies names of function parameters
  • scope: Boolean (false) - specifies whether function's code should be wrapped in with statement; the value of function's first parameter is used as expression for with statement
Source:
Returns:

Created function.

Type
function

<static> evalWith(sExpression, context, scope) → {Any}

Calculate/evaluate value of specified expression using given context and scope.

Parameters:
Name Type Argument Description
sExpression String

Expression whose value should be calculated.

context Object <optional>

Object that should be used as context (this) when expression is evaluated.

scope Object <optional>

Object that should be used as scope when expression is evaluated.

Source:
See:
Returns:

Result of expression evaluation.

Type
Any

<static> map(funcList, paramList, context) → {Array}

Call each function from specified list and return array containing results of calls.

Parameters:
Name Type Argument Description
funcList Array

Target functions that should be called.

paramList Array <optional>

Parameters that should be passed into each target function.

context Object <optional>

Object that will be used as this value when calling each target function. Default value is null.

Source:
Returns:

Results of functions calling.

Type
Array
Copyright (c) 2014 Denis Sikuler
Documentation generated by JSDoc 3.2.2 on Sun Jul 27 2014 19:29:33 GMT+0400 (MSK) using the DocStrap template.