convert-string-to-type

0.2.0 • Public • Published

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'

Package Sidebar

Install

npm i convert-string-to-type

Weekly Downloads

10

Version

0.2.0

License

MIT

Unpacked Size

7.38 kB

Total Files

18

Last publish

Collaborators

  • bingumd