@scbd/default-options

1.0.0 • Public • Published

sidebarDepth: 2

Default Options Service

Description

A service that assists in creating and validating component options. Option sets based on env dev, stg, production can be configured.

Install

yarn add @scbd/default-options

#OR 

npm install @scbd/default-options

API

setDefaultOptions

const environments  = { prod, stg, dev }
const validationMap = { expiry: Number, name: String, apisUrls: Object, dataSources: Array, version: String }

setDefaultOptions({ environments, validationMap, name: libName }, libName)

getDefaultOptionsFunction

Once the options are set for the component, export the function that returns the components options based on the env
...
export getDefaultOptionsFunction(libName)
import getDefaultOptions from './default-options.mjs'

const forceEnv = 'dev' // otherwise will look for NODE_ENV and defaults to production

getDefaultOptions({/* over write defaults*/}, forceEnv)

Readme

Keywords

none

Package Sidebar

Install

npm i @scbd/default-options

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

935 kB

Total Files

29

Last publish

Collaborators

  • sbilodeau
  • vincegopez
  • blaisefonseca
  • randyhoulahan