File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ test/unit/specs.js
3
3
explorations
4
4
node_modules
5
5
.DS_Store
6
+ .idea
6
7
benchmarks /browser.js
7
8
coverage
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ var keywords =
16
16
17
17
var wsRE = / \s / g
18
18
var newlineRE = / \n / g
19
- var saveRE = / [ \{ , ] \s * [ \w \$ _ ] + \s * : | ' [ ^ ' ] * ' | " [ ^ " ] * " / g
19
+ var saveRE = / [ \{ , ] \s * [ \w \$ _ ] + \s * : | ( ' [ ^ ' ] * ' | " [ ^ " ] * " ) / g
20
20
var restoreRE = / " ( \d + ) " / g
21
21
var pathTestRE = / ^ [ A - Z a - z _ $ ] [ \w $ ] * ( \. [ A - Z a - z _ $ ] [ \w $ ] * | \[ ' .* ?' \] | \[ " .* ?" \] | \[ \d + \] ) * $ /
22
22
var pathReplaceRE = / [ ^ \w $ \. ] ( [ A - Z a - z _ $ ] [ \w $ ] * ( \. [ A - Z a - z _ $ ] [ \w $ ] * | \[ ' .* ?' \] | \[ " .* ?" \] ) * ) / g
@@ -38,12 +38,15 @@ var saved = []
38
38
* Save replacer
39
39
*
40
40
* @param {String } str
41
+ * @param {String } isString - str if matched as a string
41
42
* @return {String } - placeholder with index
42
43
*/
43
44
44
- function save ( str ) {
45
+ function save ( str , isString ) {
45
46
var i = saved . length
46
- saved [ i ] = str . replace ( newlineRE , '\\n' )
47
+ saved [ i ] = isString
48
+ ? str . replace ( newlineRE , '\\n' )
49
+ : str . replace ( wsRE , '' )
47
50
return '"' + i + '"'
48
51
}
49
52
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ var testCases = [
62
62
expected : 'inline hel\nlo' ,
63
63
paths : [ 'a' ]
64
64
} ,
65
+ {
66
+ //multiline expressions
67
+ exp : "{\n a: '35',\n b: c}" ,
68
+ scope :{ c :32 } ,
69
+ expected : { a : '35' , b : 32 }
70
+ } ,
65
71
{
66
72
// dollar signs and underscore
67
73
exp : "_a + ' ' + $b" ,
You can’t perform that action at this time.
0 commit comments