string-converter
v1.3.5
Published
Converts strings to other javascript types
Downloads
379
Maintainers
Readme
string-converter
Converts strings to other javascript types
Installation
npm install string-converter
Usage
import { convert } from "string-converter";
const numericValue = convert("42");
==> 42
const booleanValue = convert("1");
==> true
const stringValue = convert("some string");
==> "some string"
const objectWithValue = {
value: 42,
toString: () => value.toString()
};
const stringValue = convert(objectWithValue);
==> "42";
Docs
https://jaspenlind.github.io/string-converter
Test
npm test