public create()

in packages/@aws-c2a/engine/lib/model-diffing/property-diff.ts [45:61]


  public create(
    p1: ComponentPropertyValue,
    p2: ComponentPropertyValue,
    basePathP1: Array<string | number> = [],
    basePathP2 = basePathP1,
  ): PropertyDiff {
    if(p1 instanceof ComponentPropertyRecord && p2 instanceof ComponentPropertyRecord){
      return this.fromRecordProperties(p1, p2, basePathP1, basePathP2);
    } else if(p1 instanceof ComponentPropertyArray && p2 instanceof ComponentPropertyArray){
      return this.fromArrayProperties(p1, p2, basePathP1, basePathP2);
    } else if(p1 instanceof ComponentPropertyPrimitive && p2 instanceof ComponentPropertyPrimitive){
      return this.fromPrimitives(p1, p2, basePathP1, basePathP2);
    } else if(p1 instanceof EmptyComponentProperty && p2 instanceof EmptyComponentProperty) {
      return {similarity: 1, weight: 0};
    }
    return this.fromDifferentProperties(p1, p2, basePathP1, basePathP2);
  }