static createJSONFromRuleProperty()

in src/js/utils/RuleExporter.js [196:225]


  static createJSONFromRuleProperty(property: RuleProperty): ?RulePropertyJSON {
    if (property != null && property.selector != null) {
      const attributeObject: { attribute?: ?string } =
        (property.attribute || property.definition.defaultAttribute) != null &&
        (property.attribute || property.definition.defaultAttribute) !=
          'innerContent' &&
        (property.attribute || property.definition.defaultAttribute) !=
          'textContent' &&
        (property.attribute || property.definition.defaultAttribute) !=
          'dateTextContent'
          ? {
            attribute:
                property.attribute || property.definition.defaultAttribute,
          }
          : {};
      return {
        ...attributeObject,
        ...((property.type || property.definition.defaultType) ==
        RulePropertyTypes.DATETIME
          ? { format: property.format }
          : {}),
        selector: property.selector,
        type:
          property.type != null
            ? property.type
            : property.definition.defaultType,
      };
    }
    return null;
  }