UNPKG

2.02 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/values/StringValue.js"],"names":["StringValue","PrimitiveValue","constructor","realm","value","intrinsicName","equals","x","getHash","mightBeFalse","length","throwIfNotConcreteString","_serialize","toDisplayString"],"mappings":";;;;;;;AAWA;;AACA;;AAZA;;;;;;;;;AASA;AAMe,MAAMA,WAAN,SAA0BC,sBAA1B,CAAyC;AACtDC,cAAYC,KAAZ,EAA0BC,KAA1B,EAAyCC,aAAzC,EAAiE;AAC/D,UAAMF,KAAN,EAAaE,aAAb;AACA,SAAKD,KAAL,GAAaA,KAAb;AACD;;AAIDE,SAAOC,CAAP,EAA0B;AACxB,WAAOA,aAAaP,WAAb,IAA4B,KAAKI,KAAL,KAAeG,EAAEH,KAApD;AACD;;AAEDI,YAAkB;AAChB,WAAO,uBAAW,KAAKJ,KAAhB,CAAP;AACD;;AAEDK,iBAAwB;AACtB,WAAO,KAAKL,KAAL,CAAWM,MAAX,KAAsB,CAA7B;AACD;;AAEDC,6BAAwC;AACtC,WAAO,IAAP;AACD;;AAEDC,eAAqB;AACnB,WAAO,KAAKR,KAAZ;AACD;;AAEDS,oBAA0B;AACxB;AACA,WAAQ,IAAG,KAAKT,KAAM,GAAtB;AACD;;AA/BqD","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow strict-local */\n\nimport { hashString } from \"../methods/index.js\";\nimport { PrimitiveValue, Value } from \"./index.js\";\nimport type { Realm } from \"../realm.js\";\n\nexport default class StringValue extends PrimitiveValue {\n constructor(realm: Realm, value: string, intrinsicName?: string) {\n super(realm, intrinsicName);\n this.value = value;\n }\n\n value: string;\n\n equals(x: Value): boolean {\n return x instanceof StringValue && this.value === x.value;\n }\n\n getHash(): number {\n return hashString(this.value);\n }\n\n mightBeFalse(): boolean {\n return this.value.length === 0;\n }\n\n throwIfNotConcreteString(): StringValue {\n return this;\n }\n\n _serialize(): string {\n return this.value;\n }\n\n toDisplayString(): string {\n // TODO: proper escaping\n return `\"${this.value}\"`;\n }\n}\n"],"file":"StringValue.js"}
\No newline at end of file