docs: function applyPresets(scope, defaults, presets) {
          if (!scope || !presets) { return; }
  
          // presets come from either scope (i.e. passed in directly) or get from the ui part presets
          var opts = scope.presets || (scope.item && scope.item.type && presets[scope.item.type]) || presets[scope.preset] ||
              (scope.preset && presets[scope.type + '.' + scope.preset]) || presets[scope.type];
          if (!opts) { return; }
  
          for (var name in opts) {
              if (opts.hasOwnProperty(name)) {
                  if (!defaults || defaults[name] === undefined) {
                      throw new Error('No defaults value for ' + name + ' but in options.' + scope.preset);
                  }
                  else {
                      scope[name] = opts[name];
                  }
              }
          }
      }