convert-string-to-type
v0.2.0
Published
Simple javascript type conversion.
Downloads
8
Maintainers
Readme
convert-string-to-type
Simple javaScript type conversion.
Installation
Yarn
yarn add convert-string-to-type
Npm
yarn install convert-string-to-type
Usage
import convertToType, { toBoolean, toNumber, toString } from 'convert-string-to-type'
const number = convertToType('18') // => 18
const number = toBoolean('20') // => 20
const boolean = convertToType('true') // => true
const boolean = toBoolean('False') // => false
const string = convertToType('string') // => 'string'
const string = toString(200) // => '200'