You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now if I pass undefined object as a value, it would output "undefined" string. And to exclude such attributes I would need to filter out the entire attributes object before passing it to xmlbuilder.
Consider this example:
/* * Configuration */varparam1=123;// I want to turn off param2, so it doesn't appear in xml. How do I do it here?varparam2;/* * XML building */varxml=builder.create('root').ele('test',{param1: param1,param2: param2})
Since null and undefined aren't useful anyway, I suggest to exclude them from attributes in the library itself like this:
The same thing is about boolean attributes. If someone pass false, it's unlikely that he wants to get "false" string instead of it. So, I'd like to see this:
Hello and sorry for the late response. I am thinking of adding a flag to control the behavior of null and undefined attributes. But the default behavior will be to throw an exception on such values. This would be consistent with the rest of the lib.
The true behavior you described above seems like XHTML. Since this is a generic XML generator, I don't think we should support specialized XML dialects out of the box.
Right now if I pass
undefined
object as a value, it would output"undefined"
string. And to exclude such attributes I would need to filter out the entire attributes object before passing it to xmlbuilder.Consider this example:
Since
null
andundefined
aren't useful anyway, I suggest to exclude them from attributes in the library itself like this:The same thing is about boolean attributes. If someone pass
false
, it's unlikely that he wants to get"false"
string instead of it. So, I'd like to see this:The text was updated successfully, but these errors were encountered: