Requirement

Requirement

Checks, before the actual Handler gets called

Constructor

new Requirement(object)

You can also use the other constructor styles stated in Callable.

Parameters:
Name Type Description
object object

Object or Requirement name

Properties
Name Type Attributes Description
name String

Requirement's name

callable function

Callable function

requires Array.<Requirement> <optional>

Requirement's requirements

options object <optional>

Requirement's options object

multiple boolean <optional>

Can be required more than once?

Source:

Type Definitions

callable(done, processor)

Parameters:
Name Type Description
done Requirement~done

Must be called from the callable when done

processor Processor

Processor object containing all relevant data

Source:
See:

done(erroropt, resultopt, dataopt)

Parameters:
Name Type Attributes Description
error object <optional>

Pass a truthy value if the Requirement didn't pass

result object <optional>

The Requirement's very own parameters. Will be stored in processor.params[requirementName] and usable by all next Requirements and the Handler callable

data object <optional>

Whatever is passed as data will replace all next Requirements' and the Handler's data

Source: