UNPKG

2.23 kBSource Map (JSON)View Raw
1{"version":3,"file":"string-literal.js","sourceRoot":"","sources":["../../../../src/lib/models/types/string-literal.ts"],"names":[],"mappings":";;AAAA,yCAAkC;AASlC,MAAa,iBAAkB,SAAQ,eAAI;IAgBvC,YAAY,KAAa;QACrB,KAAK,EAAE,CAAC;QARH,SAAI,GAAW,eAAe,CAAC;QASpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAOD,KAAK;QACD,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAQD,MAAM,CAAC,IAAuB;QAC1B,OAAO,IAAI,YAAY,iBAAiB;YACpC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC;IAClC,CAAC;IAMD,QAAQ;QACJ,MAAM,MAAM,GAAQ,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,OAAO,MAAM,CAAC;IAClB,CAAC;IAKD,QAAQ;QACJ,OAAO,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IAClC,CAAC;CACJ;AAzDD,8CAyDC","sourcesContent":["import { Type } from './abstract';\n\n/**\n * Represents a string literal type.\n *\n * ~~~\n * let value: \"DIV\";\n * ~~~\n */\nexport class StringLiteralType extends Type {\n /**\n * The string literal value.\n */\n value: string;\n\n /**\n * The type name identifier.\n */\n readonly type: string = 'stringLiteral';\n\n /**\n * Create a new instance of StringLiteralType.\n *\n * @param value The string literal value.\n */\n constructor(value: string) {\n super();\n this.value = value;\n }\n\n /**\n * Clone this type.\n *\n * @return A clone of this type.\n */\n clone(): Type {\n return new StringLiteralType(this.value);\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: StringLiteralType): boolean {\n return type instanceof StringLiteralType &&\n type.value === this.value;\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 result.value = this.value;\n return result;\n }\n\n /**\n * Return a string representation of this type.\n */\n toString(): string {\n return '\"' + this.value + '\"';\n }\n}\n"]}
\No newline at end of file