Namespace: allot

allot

A collection of helpers for class building
Source:

Methods

<static> factory(SuperClass, options) → {object}

Factory to build new objects based upon other ones
Parameters:
Name Type Description
SuperClass function A superclass for the new function to be constructed from
options allot~factoryOptions A set of options to configure the built function
Source:
Returns:
ChildClass
Type
object

<static> getAllMethodNames(objectName, methodNames)

Returns an array of strings of the method names of the object provided
Parameters:
Name Type Description
objectName object
methodNames array
Source:

<static> inherits(ChildConstructor, SuperConstructor) → {object}

A way to give classical inheritance to another class. Use sparingly as normal inherits npm / Utils.inherits is better usually.
Parameters:
Name Type Description
ChildConstructor function A superclass for the new function to be constructed from
SuperConstructor function A superclass for the new function to be constructed from
Source:
Returns:
ChildClass
Type
object

<static> proxyMethod(func, context) → {function}

Run a function under a certain context - this is a useful abstraction for performance and ease of maintenance
Parameters:
Name Type Description
func function function we are extending
context object The context we are applying the function to
Source:
Returns:
Returns a proxy method which will call the corresponding methods with passed in arguments
Type
function

<static> proxyMethods(methodNames, functions, context)

Run all the functions specified in the methodNames under the context
Parameters:
Name Type Description
methodNames array | true An array of methodNames to copy over or true to copy all
functions object An context object to take functions from
context object A context to run functions under
Source:

Type Definitions

factoryOptions

Factory options - A set of options to configure the built function
Type:
  • object
Properties:
Name Type Argument Default Description
staticProxyPrototypes array | true <optional>
an array of method names to map from SuperClass prototype to ChildClass
instanceProxyPrototypes array | true <optional>
an array of method names to map from SuperClass prototype to ChildClass prototype
staticProxyMethods array | true <optional>
an array of method names to map from SuperClass to ChildClass
instanceProxyMethods array | true <optional>
an array of method names to map from SuperClass to ChildClass prototype
buildFromSuper boolean <optional>
false Sets the returned object with a prototype of the superClasses constructed object
constructor class <optional>
AbstractClass an object to which to abstract classes from
Source: