On Tue, Mar 10, 2015 at 11:45 AM, Tanya Madurapperuma <[email protected]> wrote:
> > > 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? >> > > That is because as same as in javascript, as long as your isLogoutRequest > is not an empty string it will evaluate to true. > Nope, It doesn't work in Jaggey. I tried Boolean(isPassiveAuthRequired), but it returns false even for value 'true'. That's my worry. Why following doesn't work var isPassiveAuthRequired = request.getParameter("passiveAuthRequired"); // value is String if(Boolean(isPassiveAuthRequired)) { // } while following works? var isLogoutRequest = false; // here value is boolean if(!Boolean(isLogoutRequest)) { // } How this Boolean() works in Jaggery? > 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 >> >> > > > -- > Tanya Madurapperuma > > Software Engineer, > WSO2 Inc. : wso2.com > Mobile : +94718184439 > Blog : http://tanyamadurapperuma.blogspot.com > -- 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
