dist/entt.js
function cast(data, EntityClass) {
      // Check if/how EntityClass is defined or implied
      if (!EntityClass && !_lodash2.default.isArray(data)) {
        // No explicit class definition, casting data not array
        return _dataManagement2.default.cast(data, this);
      } else if (!EntityClass && _lodash2.default.isArray(data)) {
        // No explicit class definition, casting data is array
        return _dataManagement2.default.cast(data, [this]);
      } else if (_lodash2.default.isArray(EntityClass) && EntityClass.length === 0) {
        // Explicit class definition as array with implicit members
        return _dataManagement2.default.cast(data, [this]);
      } else if (_lodash2.default.isObject(EntityClass) && !_lodash2.default.isFunction(EntityClass) && _lodash2.default.values(EntityClass).length === 0) {
        // Explicit class definition as hashmap with implicit members
        return _dataManagement2.default.cast(data, _defineProperty({}, this.name, this));
      } else {
        // Explicit class definition
        return _dataManagement2.default.cast(data, EntityClass);
      }
    }
function cast(data, EntityClass) {
      // Check if/how EntityClass is defined or implied
      if (!EntityClass && !_lodash2.default.isArray(data)) {
        // No explicit class definition, casting data not array
        return _dataManagement2.default.cast(data, this);
      } else if (!EntityClass && _lodash2.default.isArray(data)) {
        // No explicit class definition, casting data is array
        return _dataManagement2.default.cast(data, [this]);
      } else if (_lodash2.default.isArray(EntityClass) && EntityClass.length === 0) {
        // Explicit class definition as array with implicit members
        return _dataManagement2.default.cast(data, [this]);
      } else if (_lodash2.default.isObject(EntityClass) && !_lodash2.default.isFunction(EntityClass) && _lodash2.default.values(EntityClass).length === 0) {
        // Explicit class definition as hashmap with implicit members
        return _dataManagement2.default.cast(data, _defineProperty({}, this.name, this));
      } else {
        // Explicit class definition
        return _dataManagement2.default.cast(data, EntityClass);
      }
    }
function cast ( data , EntityClass ) { // Check if/how EntityClass is defined or implied if ( ! EntityClass && ! _lodash2 . default . isArray ( data ) ) { // No explicit class definition, casting data not array return _dataManagement2 . default . cast ( data , this ) ; } else if ( ! EntityClass && _lodash2 . default . isArray ( data ) ) { // No explicit class definition, casting data is array return _dataManagement2 . default . cast ( data , [ this ] ) ; } else if ( _lodash2 . default . isArray ( EntityClass ) && EntityClass . length === 0 ) { // Explicit class definition as array with implicit members return _dataManagement2 . default . cast ( data , [ this ] ) ; } else if ( _lodash2 . default . isObject ( EntityClass ) && ! _lodash2 . default . isFunction ( EntityClass ) && _lodash2 . default . values ( EntityClass ) . length === 0 ) { // Explicit class definition as hashmap with implicit members return _dataManagement2 . default . cast ( data , _defineProperty ( { } , this . name , this ) ) ; } else { // Explicit class definition return _dataManagement2 . default . cast ( data , EntityClass ) ; } }
Casts provided data as a EnTT instance of given type
@export
@param {any} data Data to cast
@param {any} EntityClass Extended EnTT class to cast as
- if not provided, will cast to EnTT class this static method is being called from
- if empty array provided, will cast to array of instances of EnTT class this static method is being called from
- if empty hashmap provided, will cast to array of instances of EnTT class this static method is being called from
@returns {any} Instance of required EnTT class with provided data cast into it
Casts provided data as a EnTT instance of given type