1.5.3 • Published 2 years ago

@mimik/validation-helper v1.5.3

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
2 years ago

validation-helper

Example

const validationHelper = require('@mimik/validation-helper');

validation-helper~validateCompositeId(id) ⇒ string

A composite id is a base64 encoded object with the following structure:

 {
   "nodeId": (a string),
   "localLinkNetworkId": (a string)
 }

Kind: inner method of validation-helper
Returns: string - The id.
Category: sync
Throws:

  • object An error with the appropriate message.
ParamTypeDescription
idstringId to validate as a composite id.

validation-helper~validateOauthId(id, userId, onBehalfId) ⇒ string

Validate oauth id.

Kind: inner method of validation-helper
Returns: string - The userid or the onbehalfId.
Category: sync
Throws:

  • object Will throw an error is no match is made.
ParamTypeDescription
idstringThe id to validate.
userIdstringThe userId to validate the id against.
onBehalfIdstringThe onBehalfId to validate the id against.

validation-helper~validateLocalLinkNetworkId() ⇒ string

The localLinkNetwork id is a base64 encoded object with the following structure:

 {
   "networkAddress": (an address),
   "publicAddress": (an address)
 }

The publicAddress is not optional. If the localLinkNetwork is not present, the networkAddress is not optional and the returned localLinkNetworkId will be build.

Kind: inner method of validation-helper
Returns: string - The localLinkNetwork id.
Category: sync
Throws:

  • object Will throw an error with the appropriate message.

Params: string localLinkNetworkId - The id to validate.
Params: IP<string> networkAddress - An address to validate the id.
Params: IP<string> publicAddress - An address to validate the id.

validation-helper~validateLocation(lon, lat, elevation, type) ⇒ object

The location object has the following structure:

 {
   "type": "Point",
   "coordinates": [lon, lat],
   "elevation": (elevation), if present
 }

Kind: inner method of validation-helper
Returns: object - The location object.
Category: sync
Throws:

  • object Will throw an error with the appropriate message.
ParamTypeDescription
lonnumberLongitude (-180, 180) in degree.
latnumberLatitude (-90, 90) in degree.
elevationnumberElevation (-5000, 50000) in meters.
typestringType of coordinates (Point).

validation-helper~validateGeoLocation(location) ⇒ object

If location is not present `null will be returned.

Kind: inner method of validation-helper
Returns: object - The location.
Category: sync
Throws:

  • Will throw an error if the location fails validation.
ParamTypeDescription
locationobjectA GeoJSON location object.

validation-helper~validateUniqueAttributes(attributes) ⇒ Array.<object>

Validate unique attributes.

Kind: inner method of validation-helper
Returns: Array.<object> - An array of unique attributes.
Category: sync

ParamTypeDescription
attributesArray.<object>An array of attributes.
1.5.3

2 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.2

4 years ago

1.3.0

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago