Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e422d95

Browse filesBrowse files
author
Evan You
committed
fix vuejs#242 expressions with object literals
1 parent bab4829 commit e422d95
Copy full SHA for e422d95

File tree

Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed

‎src/exp-parser.js

Copy file name to clipboardExpand all lines: src/exp-parser.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var KEYWORDS =
2323
',Math',
2424

2525
KEYWORDS_RE = new RegExp(["\\b" + KEYWORDS.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g'),
26-
REMOVE_RE = /\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,
26+
REMOVE_RE = /\/\*(?:.|\n)*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|'[^']*'|"[^"]*"|[\s\t\n]*\.[\s\t\n]*[$\w\.]+|[\{,]\s*[\w\$_]+\s*:/g,
2727
SPLIT_RE = /[^\w$]+/g,
2828
NUMBER_RE = /\b\d[^,]*/g,
2929
BOUNDARY_RE = /^,+|,+$/g

‎test/unit/specs/exp-parser.js

Copy file name to clipboardExpand all lines: test/unit/specs/exp-parser.js
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ describe('Expression Parser', function () {
8282
hi: 2
8383
},
8484
expectedValue: '"test"1\'hi\'2'
85+
},
86+
{
87+
// expressions with inline object literals
88+
exp: "sortRows({ column: 'name', test: 'haha', durrr: 123 })",
89+
vm: {
90+
sortRows: function (params) {
91+
return params.column + params.durrr
92+
}
93+
},
94+
expectedValue: 'name123'
8595
}
8696
]
8797

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.