fixup: remove stray comment/optimize regex

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2021-05-13 10:53:38 -04:00
parent 82a5f070b5
commit 681d4a4280
No known key found for this signature in database
GPG Key ID: DB1D2F8DCDB4EE5C
3 changed files with 1 additions and 12 deletions

9
package-lock.json generated
View File

@ -637,15 +637,6 @@
"ajv": "*"
}
},
"@types/axios": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz",
"integrity": "sha1-7CMA++fX3d1+udOr+HmZlkyvzkY=",
"dev": true,
"requires": {
"axios": "*"
}
},
"@types/cacheable-request": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz",

View File

@ -21,8 +21,7 @@ export class JSONParser implements Parser {
// This is kind of a hack, but the payload data could be JSON in the form of a single
// string, such as "some data". But without the quotes in the string, JSON.parse blows
// up. We can check for this scenario and add quotes. Not sure if this is ideal.
const r = /^[[|{|"]/;
if (!r.test(payload)) {
if (!/^[[|{|"]/.test(payload)) {
payload = `"${payload}"`;
}
}

View File

@ -59,7 +59,6 @@ describe("JSON Event Format Parser", () => {
const payload = "I am a string!";
const parser = new Parser();
// TODO: Should the parser catch the SyntaxError and re-throw a ValidationError?
expect(parser.parse(payload)).to.equal("I am a string!");
});