UNPKG

@qudtlib/core

Version:

Data model for QUDTLib

1 lines 2.04 kB
{"version":3,"sources":["prefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,qBAAa,MAAO,YAAW,cAAc,CAAC,MAAM,CAAC;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,EAAE,CAAC;gBAGnB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,UAAU,EAAE;IAavB,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAY/B,QAAQ,IAAI,MAAM;IAOlB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAGlC","file":"prefix.d.ts","sourcesContent":["import { SupportsEquals } from \"./baseTypes.js\";\nimport { LangString } from \"./langString.js\";\nimport {\n arrayEqualsIgnoreOrdering,\n compareUsingEquals,\n getLastIriElement,\n} from \"./utils.js\";\nimport { Decimal } from \"decimal.js\";\n\nexport class Prefix implements SupportsEquals<Prefix> {\n iri: string;\n multiplier: Decimal;\n symbol: string;\n ucumCode?: string;\n labels: LangString[];\n\n constructor(\n iri: string,\n multiplier: Decimal,\n symbol: string,\n ucumCode?: string,\n labels?: LangString[]\n ) {\n this.iri = iri;\n this.multiplier = multiplier;\n this.symbol = symbol;\n this.ucumCode = ucumCode;\n if (typeof labels === \"undefined\") {\n this.labels = [];\n } else {\n this.labels = labels;\n }\n }\n\n equals(other?: Prefix): boolean {\n return (\n !!other &&\n this.iri === other.iri &&\n this.multiplier.equals(other.multiplier) &&\n this.symbol === other.symbol &&\n this.ucumCode === other.ucumCode &&\n this.labels.length == other.labels.length &&\n arrayEqualsIgnoreOrdering(this.labels, other.labels, compareUsingEquals)\n );\n }\n\n toString(): string {\n if (this.symbol) {\n return this.symbol;\n }\n return \"prefix:\" + getLastIriElement(this.iri);\n }\n\n addLabel(label: LangString): void {\n this.labels.push(label);\n }\n}\n"]}