2.0.2 • Published 8 months ago

@mimik/validation-helper v2.0.2

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
8 months ago

validation-helper

Example

import validationHelper from '@mimik/validation-helper';
or
import { validateCompositeId } from '@mimik/validation-helper';

validation-helper~validateCompositeId(id) ⇒ object

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

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

Kind: inner method of validation-helper
Returns: object - The decoded composite id object.
Category: sync
Throws:

  • Error If the id is not a valid base64 composite.
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 validated id.
Category: sync
Throws:

  • Error If validation fails.
ParamTypeDescription
idstringThe id to validate.
userIdstringThe userId to validate against.
onBehalfIdstringThe onBehalfId to validate against.

validation-helper~validateLocalLinkNetworkId(localLinkNetworkId, networkAddress, publicAddress) ⇒ string

The localLinkNetworkId is a base64 encoded object:

{
  "networkAddress": (string),
  "publicAddress": (string)
}

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

  • Error If validation fails.
ParamTypeDescription
localLinkNetworkIdstringThe id to validate.
networkAddressstringA network address.
publicAddressstringA public address.

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

Validate location.

Kind: inner method of validation-helper
Returns: object | null - The validated location object, or null if all values are missing.
Category: sync
Throws:

  • Error If validation fails.
ParamTypeDescription
lonnumberLongitude (-180, 180) in degrees.
latnumberLatitude (-90, 90) in degrees.
elevationnumberElevation (-5000, 50000) in meters.
typestringType of coordinates ("Point").

validation-helper~validateGeoLocation(location) ⇒ object | null

Validate GeoLocation.

Kind: inner method of validation-helper
Returns: object | null - The validated location, or null if not present.
Category: sync
Throws:

  • Error If validation fails.
ParamTypeDescription
locationobject | nullA GeoJSON location object.

validation-helper~validateUniqueAttributes(attributes) ⇒ boolean

Validate unique attributes.

Kind: inner method of validation-helper
Returns: boolean - True if attributes are unique by name.
Category: sync

ParamTypeDescription
attributesArray.<object>An array of attributes with a name property.
2.0.2

8 months ago

2.0.1

8 months ago

2.0.0

9 months ago

1.5.3

2 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

4 years ago

1.4.2

4 years ago

1.3.0

6 years ago

1.2.4

6 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago