@masteravodoprovodchiki/casttovania

0.0.3 • Public • Published

CastToVania

CircleCI

Cast your string to something another
Maybe to string, maybe to number, maybe to array of numbers!
Also supports booleans

Installation

yarn add @masteravodoprovodchiki/casttovania

# if you use npm

npm i --save @masteravodoprovodchiki/casttovania

Examples

const cast = require('@masteravodoprovodchiki/casttovania')

const number = cast('1')            // will be 1
const number = cast('true')         // will be true
const number = cast('TRUE')         // will be true
const number = cast('TrUe')         // will be true
const number = cast('false')        // will be false
const string = cast('foo')          // will be 'foo'
const array0 = cast('foo,bar')      // will be ['foo', 'bar']
const array1 = cast('foo,1')        // will be ['foo', 1]
const array2 = cast('foo,')         // will be ['foo']

Readme

Keywords

none

Package Sidebar

Install

npm i @masteravodoprovodchiki/casttovania

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

6.24 kB

Total Files

20

Last publish

Collaborators

  • evilfant