UNPKG

auto-parse

Version:

Automatically convert any value to its best matching JavaScript type. Supports numbers, booleans, objects, arrays, BigInt, Symbol, comma-separated numbers, prefix stripping, allowed type enforcement and a plugin API.

10 lines (7 loc) 167 B
const autoParse = require('..') autoParse.use((value) => { if (value === 'color:red') { return { color: '#FF0000' } } }) console.log(autoParse('color:red'))