0.4.53 • Published 6 years ago

interbit-covenant-tools v0.4.53

Weekly downloads
13
License
MIT
Repository
-
Last release
6 years ago

interbit-covenant-tools

This library contains reusable covenant components that provide core functionality for managing template deployment and utilities that make it easier to write covenants that conform to standard patterns.

This library is intended to have a small footprint. Any PRs that add external dependencies will be scrutinized carefully and are likely to be rejected.

validate

interbit-covenant-tools contains a lightweight and flexible validation library for validating action creators and action payloads within covenants.

Usage:

const {
  validate,
  objectValidationRules: { required, faIconPattern, chainIdPattern }
} = require('@btlgroup/interbit-covenant-tools')

const actionTypes = {
  UPDATE_PROJECT: 'project/UPDATE_PROJECT',
  REGISTER_PROJECT: 'project/REGISTER_PROJECT'
}

const actionCreators = {
  updateProject: ({ projectName, description, icon, launchUrl }) => ({
    type: actionTypes.UPDATE_PROJECT,
    payload: validate(
      { projectName, description, icon, launchUrl },        // Object to validate
      { projectName: required(), icon: faIconPattern() }    // Validation rules attached to properties
    )
  }),

  registerProject: ({ parentChainId }) => ({
    type: actionTypes.REGISTER_PROJECT,
    payload: validate(
      { parentChainId },                       // Object to validate
      { parentChainId: chainIdPattern() }      // Validation rules attached to properties
    )
  })
}
0.4.53

6 years ago

0.4.52

6 years ago

0.4.51

6 years ago

0.4.50

6 years ago

0.4.49

6 years ago

0.4.48

6 years ago

0.4.46

6 years ago

0.4.44

6 years ago

0.4.43

6 years ago

0.4.42

6 years ago

0.4.41

6 years ago

0.4.40

6 years ago

0.4.39

6 years ago

0.4.38

6 years ago

0.4.37

6 years ago

0.4.35

6 years ago

0.4.34

6 years ago

0.4.33

6 years ago

0.4.31

6 years ago

0.4.30

6 years ago

0.4.29

6 years ago

0.4.28

6 years ago

0.4.27

6 years ago

0.4.26

6 years ago

0.4.25

6 years ago

0.4.24

6 years ago

0.4.23

6 years ago

0.4.22

6 years ago

0.4.20

6 years ago

0.4.19

6 years ago

0.4.18

6 years ago

0.4.17

6 years ago

0.4.16

6 years ago

0.4.15

6 years ago

0.4.14

6 years ago

0.4.13

6 years ago

0.4.12

6 years ago