TODO: Description for tis module
- License:
- 
		- GPL-3.0
 
Classes
Methods
- 
    <static> cacheCalls(obj, method_name, ttl)
- 
    
    Replaces a method of provided object with a proxy, that will cache the return value of the original method for the givin period of time. If the proxy is called the original method will be called only if there is no cached value. The proxy method will allways wrap the original method in a Promise. This may help to prevent redundant API calls (e.g. if you know that the result of an API call will not change in the next 10 seconds) Two calls with different arguments will be cached separately. Two sets of arguments are considered equal if their JSON representaions are equal. The orginial method can be restored with obj[method_name].restore(). Parameters:Name Type Default Description objObject Target object method_nameString Name of the method whose calls should be cached. ttlNumber 1000 Time to live for the cache values in milliseconds. Throws:- 
        If method_name does not point to a function. 
- Type
- TypeError
 Returns:undefined 
- 
        
- 
    <static> catchAsyncErrors(fn)
- 
    
    Wrapper for express request handlers to catch rejected promises or async methods. Parameters:Name Type Description fnfunction Express request handler to wrap Returns:Wrapped request handler - Type
- function
 
- 
    <static> collateCalls(obj, method_name [, force_call_after])
- 
    
    Replaces a method of provided object with a proxy, that will prevent multiple calls to the original method with the same arguments while waiting for a response. The proxy method will allways wrap the original method in a Promise. If a previous call with the same arguments is still pending the proxy will return the corresponding promise. This may help to prevent multiple redudant API calls. (e.g. when you dont expect the result of an API call to change while it's pending) Two sets of arguments are considered equal if their JSON representaions are equal. The orginial method can be restored with obj[method_name].restore(). Parameters:Name Type Argument Default Description objObject Target object method_namestring Name of the method whose calls should be callated force_call_afterNumber <optional> 
 1000 After this time (in milliseconds) the proxy will call the original method, regardless of previous calls still pending. Throws:- 
        If method_name does not point to a function. 
- Type
- TypeError
 Returns:undefined 
- 
        
- 
    <static> errorHandler(err, req, res, next)
- 
    
    Custom Express error handler, tailored to work with DocloopError. Will terminate a request with a proposed error code if error is instance of DocloopError, will use 500 if not. Parameters:Name Type Description errObject Express error reqObject Express request resObject Express result nextfunction Express next Returns:- Type
- undefined
 
- 
    <static> serializeCalls(obj, method_names)
- 
    
    Replaces a method of provided object with a proxy, that will chain consecutive calls: So the orginal method will be called right after all previous calls have been resolved or rejected. The proxy method will allways wrap the original method in a Promise. You can provide an array of method names to serialize multiple methods at once. This may help to prevent timing conflicts of multiple calls. The orginial mthod can be restored with obj.[method_name].restore(). Parameters:Name Type Description objObject Target object method_namesstring | Array.<string> Name(s) of the method(s) whose calls should be serialized. Throws:- 
        If one of the method names does not point to a function. 
- Type
- TypeError
 Returns:undefined 
-