Source: models/PathItem.js


var Depot = require('./Depot');
var Dir = require('./Dir');
var File = require('./File');

require('../polyfill');

function toItem(obj) {
  if (obj['Dir']) {
    return new Dir(obj);
  } else if (obj['DepotFile']) {
    return new File(obj);
  } else if (obj['Depot']) {
    return new Depot(obj);
  }
}

/**
 *
 * @static
 * @type {{create: Function}}
 */
var PathItem = {

  /**
   *
   * @param items
   * @name PathItem.create
   */
  create: function(items) {
    items.map(function(x) { toItem(x); });
  }
};

module.exports = PathItem;