jmespath / jmespath/jmespath.js

Escape single quotes in a raw string literal

Open
#98 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
847
Forks
101
PR merge metrics
No merged PRs in 30d

Description

I may escape a single quote symbol in a path using `\`
For instance:
```ts
jmespath.search(
[{ state: "W'A" }, { state: "N'Y" }, { state: "W'A" }, { state: "W'A" }],
`length([?state == 'W\\'A'])`,
)
// Result: 3
```

But I can escape only one single quote in a raw string literal.
For instance:
```ts
jmespath.search(
[{ state: "W'A'A" }, { state: "N'Y" }, { state: "W'A'A" }, { state: "W'A'A" }],
`length([?state == 'W\\'A\\'A'])`,
)
// Result: 0
```

Expected behaviour:
Ability to escape as many single quotes as you want in a string literal using `\` symbol.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.