0.2.0 • Published 7 months ago

convert-string-to-type v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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'