UNPKG

@travlrcom/uikit

Version:

TRAVLR UiKit

46 lines (38 loc) 1.31 kB
/** **************************************************** *** ******* ****** **** *** ****** ****** ***** *********** ************** ****** ****** *********** ************* ****** ******* *********** ************ ****** ******** *********** *********** ****** ********* *********** ********** ****** ********** *********** ********* ****** *********** *********** ******** ****** ************ *********** ******* ****** ************* *********** ****** ****** ************** **************************************************** * -------------------------------------------------- * Travlr UiKit: booleanParse.js * By Travlr Team * -------------------------------------------------- */ // const const NAME = 'booleanParse' class BooleanParse { constructor (value) { this._pattern = /^(?:f(?:alse)?|no?|0+)$/i this._value = value this._valueParse = false this.init() } init () { this._valueParse = !this._pattern.test(this._value) && !!this._value } } const BooleanParseInit = (value) => { let data = new BooleanParse(value) let result = data._valueParse return result } export default BooleanParseInit