@chimanos/envalid-hex-string
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@chimanos/envalid-hex-string

Envalid hex string validator.

Installation

yarn add @chimanos/envalid-hex-string
# or
npm install @chimanos/envalid-hex-string

Usage

import * as envalid from 'envalid'
import hexStringValidator from '@chimanos/envalid-hex-string'

type MyEnv = {
  MY_HEX_STR: string
}

const myEnvValidators = {
  MY_HEX_STR: hexStringValidator({
    // Options
  })()
}

// With MY_HEX_STR=0xF09
const myEnv = envalid.cleanEnv<MyEnv>(process.env, myEnvValidators)

Options

in0x (true | false | 'optional')

Determine wether a leading 0x is required (true), forbidden (false) or optional ('optional')

out0x (true | false | 'in')

Determine wether a leading 0x is added to the response always (true), never (false) or respecting input ('in')

inCase ('upper' | 'lower' | 'any')

Determine wether input case must be uppercase ('upper'), lowercase ('lower') or doesn't matter ('any')

outCase ('upper' | 'lower' | 'in')

Determine wether output case is transformed to uppercase ('upper'), lowercase ('lower') or left as-is ('in')

Readme

Keywords

none

Package Sidebar

Install

npm i @chimanos/envalid-hex-string

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

12.6 kB

Total Files

9

Last publish

Collaborators

  • cyril.chapon