code: function castProperty(type, value) {
    // Some special handling is needed for some properties as they may be delivered
    // as strings HTML delivers attributes as strings.
    switch (type) {
      // Translate strings into booleans
      case Boolean:
        if (['false', '0', 'null', 'undefined'].indexOf(value) !== -1) {
          return false;
        } else {
          return Boolean(value);
        }
  
      case Number:
        return Number(value);
  
      // Translate strings into functions
      case Function:
        /* eslint-disable-next-line */
        return typeof value === 'string' ? eval('(' + value + ')') : value;
      case Object:
        if (value && typeof value === 'string') {
          try {
            return JSON.parse(value);
          } catch (e) {
            // no-op
          }
        }
    }
    return value;
  }
docs: /*
  Cast a property value to its specified type