@@ -50,12 +50,17 @@ function type (obj) {
5050 * Generate an XML plist string from the input object `obj`.
5151 *
5252 * @param {Object } obj - the object to convert
53- * @param {Object } [opts] - optional options object
53+ * @param {Object } [xmlToStringOpts] - optional XMLToStringOptions object
54+ * @param {Object } [createOpts] - optional CreateOptions object
5455 * @returns {String } converted plist XML string
5556 * @api public
5657 */
5758
58- function build ( obj , opts ) {
59+ function build ( obj , xmlToStringOpts , createOpts ) {
60+ if ( xmlToStringOpts === undefined ) xmlToStringOpts = { } ;
61+ if ( createOpts === undefined ) createOpts = { } ;
62+ xmlToStringOpts . pretty = xmlToStringOpts . pretty !== false ;
63+
5964 var XMLHDR = {
6065 version : '1.0' ,
6166 encoding : 'UTF-8'
@@ -66,18 +71,15 @@ function build (obj, opts) {
6671 sysid : 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
6772 } ;
6873
69- var doc = xmlbuilder . create ( 'plist' ) ;
74+ var doc = xmlbuilder . create ( 'plist' , createOpts ) ;
7075
7176 doc . dec ( XMLHDR . version , XMLHDR . encoding , XMLHDR . standalone ) ;
7277 doc . dtd ( XMLDTD . pubid , XMLDTD . sysid ) ;
7378 doc . att ( 'version' , '1.0' ) ;
7479
7580 walk_obj ( obj , doc ) ;
7681
77- if ( ! opts ) opts = { } ;
78- // default `pretty` to `true`
79- opts . pretty = opts . pretty !== false ;
80- return doc . end ( opts ) ;
82+ return doc . end ( xmlToStringOpts ) ;
8183}
8284
8385/**
0 commit comments