unescaping any strings

This commit is contained in:
Hetu Nandu 2020-01-08 16:20:49 +05:30
parent 5dbc375f89
commit 91ecf6ebac
4 changed files with 18 additions and 2 deletions

View File

@ -81,7 +81,8 @@
"styled-components": "^4.1.3",
"tinycolor2": "^1.4.1",
"ts-loader": "^6.0.4",
"typescript": "^3.6.3"
"typescript": "^3.6.3",
"unescape-js": "^1.1.4"
},
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",

View File

@ -4,6 +4,7 @@ import { DATA_BIND_REGEX } from "constants/BindingsConstants";
import ValidationFactory from "./ValidationFactory";
import JSExecutionManagerSingleton from "jsExecution/JSExecutionManagerSingleton";
import { NameBindingsWithData } from "selectors/nameBindingsWithDataSelector";
import unescapeJS from "unescape-js";
export const isDynamicValue = (value: string): boolean =>
DATA_BIND_REGEX.test(value);
@ -72,7 +73,8 @@ export const evaluateDynamicBoundValue = (
data: NameBindingsWithData,
path: string,
): any => {
return JSExecutionManagerSingleton.evaluateSync(path, data);
const unescapedInput = unescapeJS(path);
return JSExecutionManagerSingleton.evaluateSync(unescapedInput, data);
};
// For creating a final value where bindings could be in a template format

View File

@ -0,0 +1 @@
declare module "unescape-js";

View File

@ -14108,6 +14108,11 @@ string-width@^4.1.0, string-width@^4.2.0:
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
string.fromcodepoint@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/string.fromcodepoint/-/string.fromcodepoint-0.2.1.tgz#8d978333c0bc92538f50f383e4888f3e5619d653"
integrity sha1-jZeDM8C8klOPUPOD5IiPPlYZ1lM=
"string.prototype.matchall@^4.0.0 || ^3.0.1":
version "4.0.2"
resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e"
@ -14827,6 +14832,13 @@ uglify-js@^3.1.4:
commander "~2.20.3"
source-map "~0.6.1"
unescape-js@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/unescape-js/-/unescape-js-1.1.4.tgz#4bc6389c499cb055a98364a0b3094e1c3d5da395"
integrity sha512-42SD8NOQEhdYntEiUQdYq/1V/YHwr1HLwlHuTJB5InVVdOSbgI6xu8jK5q65yIzuFCfczzyDF/7hbGzVbyCw0g==
dependencies:
string.fromcodepoint "^0.2.1"
unfetch@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.1.0.tgz#6ec2dd0de887e58a4dee83a050ded80ffc4137db"