diff options
Diffstat (limited to 'install/ui/ipa.js')
-rw-r--r-- | install/ui/ipa.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 7667c7669..f0ad01c32 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -1087,6 +1087,34 @@ IPA.build = function(spec, builder_fac) { return product; }; +IPA.build_default = function(spec, def_spec) { + + var builder, factory, default_object; + + if (!spec && !def_spec) return null; + + if (typeof def_spec === 'function') { //factory function + factory = def_spec; + } else if (typeof def_spec === 'object') { + default_object = def_spec; + } + + builder = IPA.builder({ + factory: factory + }); + + var product; + spec = spec || default_object || {}; + + if ($.isArray(spec)) { + product = builder.build_objects(spec); + } else { + product = builder.build(spec); + } + + return product; +}; + IPA.default_factory = function(spec) { spec = spec || {}; |