UNPKG

2.88 kBSource Map (JSON)View Raw
1{"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../../src/lib/models/types/intersection.ts"],"names":[],"mappings":";;AAAA,yCAAkC;AASlC,MAAa,gBAAiB,SAAQ,eAAI;IAgBtC,YAAY,KAAa;QACrB,KAAK,EAAE,CAAC;QARH,SAAI,GAAW,cAAc,CAAC;QASnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAOD,KAAK;QACD,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAQD,MAAM,CAAC,IAAsB;QACzB,IAAI,CAAC,CAAC,IAAI,YAAY,gBAAgB,CAAC,EAAE;YACrC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,eAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAMD,QAAQ;QACJ,MAAM,MAAM,GAAQ,KAAK,CAAC,QAAQ,EAAE,CAAC;QAErC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACjC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SACtD;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAKD,QAAQ;QACJ,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;CACJ;AApED,4CAoEC","sourcesContent":["import { Type } from './abstract';\n\n/**\n * Represents an intersection type.\n *\n * ~~~\n * let value: A & B;\n * ~~~\n */\nexport class IntersectionType extends Type {\n /**\n * The types this union consists of.\n */\n types: Type[];\n\n /**\n * The type name identifier.\n */\n readonly type: string = 'intersection';\n\n /**\n * Create a new TupleType instance.\n *\n * @param types The types this union consists of.\n */\n constructor(types: Type[]) {\n super();\n this.types = types;\n }\n\n /**\n * Clone this type.\n *\n * @return A clone of this type.\n */\n clone(): Type {\n return new IntersectionType(this.types);\n }\n\n /**\n * Test whether this type equals the given type.\n *\n * @param type The type that should be checked for equality.\n * @returns TRUE if the given type equals this type, FALSE otherwise.\n */\n equals(type: IntersectionType): boolean {\n if (!(type instanceof IntersectionType)) {\n return false;\n }\n return Type.isTypeListSimilar(type.types, this.types);\n }\n\n /**\n * Return a raw object representation of this type.\n * @deprecated Use serializers instead\n */\n toObject(): any {\n const result: any = super.toObject();\n\n if (this.types && this.types.length) {\n result.types = this.types.map((e) => e.toObject());\n }\n\n return result;\n }\n\n /**\n * Return a string representation of this type.\n */\n toString() {\n const names: string[] = [];\n this.types.forEach((element) => {\n names.push(element.toString());\n });\n\n return names.join(' & ');\n }\n}\n"]}
\No newline at end of file