[Kimchi-devel] [PATCH 1/3] Extend base classes to support form processing

Adam King rak at linux.vnet.ibm.com
Fri Apr 4 13:25:01 UTC 2014


On 4/1/2014 2:47 PM, Aline Manera wrote:
>> +        var openBracket=this.indexOf("[");
>
> Does not exist an eval() function in JS to confirm it is a array or not?
> I think it would be safer than compare strings.
>
>> +        if (openBracket!=-1) {
>> +            var id=this.slice(0, open
This check isn't actually to determine if this is an array, but is used 
to break down the accessor of the Object whether its an array or not. 
There IS an eval() function in Javascript that could be used when 
reading the values from the object, but couldn't be used when building 
the object. The eval() function is generally discouraged for a few 
reasons. See 
http://stackoverflow.com/questions/86513/why-is-using-the-javascript-eval-function-a-bad-idea 
and 
http://www.nczonline.net/blog/2013/06/25/eval-isnt-evil-just-misunderstood/

Though coding my own parser is more error prone than using eval for the 
read, its the only option I see for the construction flow.

-- 
Adam King <rak at linux.vnet.ibm.com>
IBM C&SI





More information about the Kimchi-devel mailing list