panzerdp / voca

The ultimate JavaScript string library
https://vocajs.pages.dev
MIT License
3.61k stars 136 forks source link

Support for converting possible boolean strings to actual boolean values #44

Closed vikneswaran20 closed 5 years ago

vikneswaran20 commented 5 years ago

Support for converting the boolean type of string to actual boolean

Converting the logical booelan strings to respective booleans v.boolean('true'); // => true v.boolean('1'); // => true v.boolean('yes'); // => true v.boolean('false'); // => false v.boolean('0'); // => false v.boolean('no'); // => false

The comparisons are case insensitive The list of truth values we can consider -> 'true', true, '1', 1, 'yes', 'on'

If this is fine I will submit a pull request for this function implementation.

panzerdp commented 5 years ago

Thanks for idea. For now I'm not interested in such a function because I see it has limited usage.