Jump to content

Object.values is not a function?


Mad_Griffith

Recommended Posts

I don't seem to get my head around the reason why the following returns TypeError: Object.values is not a function

var input = '[a docs/my_pdf.pdf|here§my_class#my_id][img imgs/myimg.jpg|Alt title][g Artificial Languages][lang]HTML, CSS, Sass, SMACSS, SVG[y]7[/y][/lang][/g][p]Yes[/p]';

var RegEx = {
'tagClass': {
'\§\s*(.+?)\s*[\§\|\]\#]': ' class="$1"'
},
'tagId': {
'\#\s*(.+?)\s*[\§\|\]\#]': ' id="$1"'
},
'tagAlt': {
'\[img.+?\|\s*(.+?)\s*[\§\|\]\#]': ' alt="$1"'
},
'tagTitle': {
'\[a.+?\|\s*(.+?)\s*[\§\|\]\#]': ' title="$1"'
},
'tagSrc': {
'\[img\s*(.+?)\s*[\§\|\]\#]': ' src="$1"'
},
'tagHref': {
'\[a\s*(.+?)\s*[\§\|\]\#]': ' href="$1"'
},
'tagAngleBrackets': {
'\[(\/?)(.+?(?=[\]]))\]?': '<$1$2>'
}
};


for (var tag in RegEx) {
   input.replace(new RegExp(Object.keys(RegEx[tag])[0], 'g'), Object.values(RegEx[tag])[0]);
}
Edited by Mad_Griffith
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...