Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #6865 from gregorwagner/phone

Bug 817563 - [PhoneNumberJS] Remove .eval() from code
  • Loading branch information...
commit 93dd992e63af144b9e75fdfdd658d9acb515e762 2 parents 8ca3aa6 + 1da94a1
@gregorwagner gregorwagner authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 shared/js/phoneNumberJS/PhoneNumber.js
View
4 shared/js/phoneNumberJS/PhoneNumber.js
@@ -11,6 +11,8 @@ var PhoneNumber = (function (dataBase) {
const NON_DIALABLE_CHARS = /[^+\*\d]/g;
const PLUS_CHARS = /^[+\uFF0B]+/;
const BACKSLASH = /\\/g;
+ const COMMACOMMA = /,,/g;
+ const COMMABRACKET = /,]/g;
const SPLIT_FIRST_GROUP = /^(\d+)(.*)$/;
// Format of the string encoded meta data. If the name contains "^" or "$"
@@ -53,7 +55,7 @@ var PhoneNumber = (function (dataBase) {
// Parse string encoded meta data into a convenient object
// representation.
function ParseMetaData(countryCode, md) {
- var array = eval(md.replace(BACKSLASH, "\\\\"));
+ var array = JSON.parse(md.replace(BACKSLASH, "\\\\").replace(COMMACOMMA, ', null,').replace(COMMACOMMA, ', null,').replace(COMMABRACKET, ', null]'));
md = ParseArray(array,
META_DATA_ENCODING,
{ countryCode: countryCode });
Please sign in to comment.
Something went wrong with that request. Please try again.