1 | import { stringIsNullOrEmpty } from "@pnp/core";
|
2 | export function escapeQueryStrValue(value) {
|
3 | if (stringIsNullOrEmpty(value)) {
|
4 | return "";
|
5 | }
|
6 | // replace all instance of ' with ''
|
7 | if (/!(@.*?)::(.*?)/ig.test(value)) {
|
8 | // to ensure our param aliasing still works we need to treat these special or we'll hear about it
|
9 | // so we encode JUST the part that will end up in the url
|
10 | return value.replace(/!(@.*?)::(.*)$/ig, (match, labelName, v) => {
|
11 | return `!${labelName}::${encodeURIComponent(v.replace(/'/ig, "''"))}`;
|
12 | });
|
13 | }
|
14 | else {
|
15 | return encodeURIComponent(value.replace(/'/ig, "''"));
|
16 | }
|
17 | }
|
18 | //# sourceMappingURL=escape-query-str.js.map |
\ | No newline at end of file |