Hi Abimaran, I have tried a sample Boolean() function. It works for me too. You can try something like following to evaluate strings.
var a = "true"; var val = (a === 'true'); log.debug(Boolean(val)); On Tue, Mar 10, 2015 at 11:29 AM, Abimaran Kugathasan <[email protected]> wrote: > Thanks Himasha, > > In Jaggery, follwing is possible to do and works fine. > > var isLogoutRequest = false; > > if(!Boolean(isLogoutRequest)) { > // > } > > > I was thinking, why can't we have this type of conversion for String value > of true/false in Jagger? > > On Tue, Mar 10, 2015 at 11:19 AM, Himasha Guruge <[email protected]> > wrote: > >> Hi Abimaran, >> >> You could check [1] for different options. Check the answer where they >> are prioritized based on performance. >> >> [1] >> http://stackoverflow.com/questions/263965/how-can-i-convert-a-string-to-boolean-in-javascript/28588344#28588344 >> >> Thanks, >> Himasha >> >> On Tue, Mar 10, 2015 at 11:03 AM, Abimaran Kugathasan <[email protected]> >> wrote: >> >>> Hi, >>> >>> I have a query string parameter with value true or false. I need to >>> convert this value to corresponding boolean value for some conditional >>> checking. >>> >>> Currently, I'm using string comparision with == to evaluate. >>> >>> var isPassiveAuthRequired = request.getParameter("passiveAuthRequired"); >>> >>> if('true' == isPassiveAuthRequired) { >>> // >>> } >>> >>> This doesn't look a proper way. I tried Boolean(isPassiveAuthRequired), >>> but it returns false even for value 'true'. >>> >>> Anybody knows a better way? >>> >>> -- >>> Thanks >>> Abimaran Kugathasan >>> >>> Software Engineer | WSO2 Inc >>> Data & APIs Technologies Team >>> Mobile : +94 773922820 >>> >>> <http://stackoverflow.com/users/515034> >>> <http://lk.linkedin.com/in/abimaran> >>> <http://www.lkabimaran.blogspot.com/> <https://github.com/abimaran> >>> <https://twitter.com/abimaran> >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Himasha Guruge >> *Software Engineer* >> WS*O2* *Inc.* >> Mobile: +94 777459299 >> [email protected] >> > > > > -- > Thanks > Abimaran Kugathasan > > Software Engineer | WSO2 Inc > Data & APIs Technologies Team > Mobile : +94 773922820 > > <http://stackoverflow.com/users/515034> > <http://lk.linkedin.com/in/abimaran> > <http://www.lkabimaran.blogspot.com/> <https://github.com/abimaran> > <https://twitter.com/abimaran> > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Inshaf Mahath Associate Software Engineer Mobile: +94775907181 WSO2 Inc. Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
