... var object = req.responseJSON.Obj, array = Object.isArray(object) ? object : [object]; ... array.each( ... ) ...
- kangax On Jun 24, 2:20 pm, buda <[EMAIL PROTECTED]> wrote: > I work with JSON property like Obj which might be null, a single > oblect or a collection of objects > Every time I must analize > > if (req.responseJSON.Obj == null){ > .... > > } > > if (req.responseJSON.Obj && !req.responseJSON.Obj.length){ > ... ia a single instanse > > } > > if (req.responseJSON.Obj && req.responseJSON.Obj.length){ > req.responseJSON.Obj.each(....) > > } > > but I want to do with resul in the same manner > req.responseJSON.Obj.each(....) > > if I use $A(req.responseJSON.Obj) it doesnt represent a single > instanse as an array and how should I do it ? > Help me please --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---