pixelplux-dk-common

Internally we share some code between server, mobile application, and front-end apps. So we decided to put these codes here on this repository.

Usage no npm install needed!

<script type="module">
  import pixelpluxDkCommon from 'https://cdn.skypack.dev/pixelplux-dk-common';
</script>

README

dk-common

Internally we share some code between server, mobile application, and front-end apps. So we decided to put these codes here on this repository.

Installing

Depending on the location of repository, you might be able to install it using npm:

npm install pixelplux-dk-common --save

yachtValidator

Validates a yacht entity, and returns an object of errors if there will be some errors.

export function yachtValidator(yacht, translate)

example how to use:

import { yachtValidator } from 'pixelplux-dk-common';
yachtValidator({name: 'Sample boat'}, translate => translate);

Yacht information

boatTypes

You can get and Array of <label, value> of boat types that we support.

import { boatTypes, boatLengths } from 'pixelplux-dk-common'

example:

export const boatTypes = [
  {
    label: 'Sailboat',
    value: 'sailboat'
  },
  ...
];

Note: translate is a callback, which will be used to translate each field. It should accept a param for key, and return the translated value.