Internationalisation
Bundled Plugins API
Require
​
A Statement that will require that the resolvable value matches a predicate, and if not, it will send an error.

Submodules

API Overview

  • Constants - Useful values which cannot be changed
  • ​OrThrow​
  • Functions - API calls offered directly by the extension
  • ​Require​
  • Methods - API calls which can only be made on an object returned by a constructor
  • ​Are​
  • ​AreNot​
  • ​Is​
  • ​IsNot​
  • ​Matches​
  • ​OrThrow​

API Documentation

Constants

​OrThrow​

Signature
cp.rx.go.Require.OrThrow <cp.rx.go.Statement.Modifier>
Type
Constant
Description
A Statement.Modifier that sets the message to throw if the requirement is not met.

Functions

​Require​

Signature
cp.rx.go.Require(requirement) -> Require
Type
Function
Description
Creates a new Require Statement with the specified requirement.
Parameters
  • requirement - a resolvable value that will be checked.
Returns
  • The Statement instance which will check if the requirement matches the requirement.

Methods

​Are​

Signature
cp.rx.go.Require:Are(value) -> Require.Are
Type
Method
Description
Specifies the value to check.
Parameters
  • value - The value that all results from the requirement must match.
Returns
  • The Are Statement.Modifier.

​AreNot​

Signature
cp.rx.go.Require:AreNot(value) -> Require.AreNot
Type
Method
Description
Specifies the value to check.
Parameters
  • value - The value that all results from the requirement must match.
Returns
  • The AreNot Statement.Modifier.

​Is​

Signature
cp.rx.go.Require:Is(value) -> Require.Is
Type
Method
Description
Specifies the value to check.
Parameters
  • value - The value that all results from the requirement must match.
Returns
  • The Is Statement.Modifier.

​IsNot​

Signature
cp.rx.go.Require:IsNot(value) -> Require.IsNot
Type
Method
Description
Specifies the value to check.
Parameters
  • value - The value that all results from the requirement must not match.
Returns
  • The IsNot Statement.Modifier.

​Matches​

Signature
cp.rx.go.Require:Matches(predicate) -> Require.Matches
Type
Method
Description
Specifies the predicate to check.
Parameters
  • value - The value that all results from the requirement must not match.
Returns
  • The Matches Statement.Modifier.

​OrThrow​

Signature
cp.rx.go.Require:OrThrow(message) -> Require.OrThrow
Type
Method
Description
Specifies the message to throw if the requirement is not met.
Parameters
  • message - The string to throw when there is an error.
Returns
  • The OrThrow Statement.Modifier.