Skip to content

Commit

Permalink
[amd] [parse] refs brython-dev#188 - Wrap brython_tests.util AMD defi…
Browse files Browse the repository at this point in the history
…nition in function call
  • Loading branch information
olemis committed Feb 13, 2016
1 parent 546fb5f commit a059856
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions www/tests/amd/brython_tests/util.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@

define({
'escape_string' : function(str) {
return ('' + str).replace(/["'\\\n\r\u2028\u2029]/g, function(ch) {
switch(ch) {
case '"' :
case '\\' :
case "'" :
return '\\' + ch;
case '\n' :
return '\\n';
case '\r' :
return '\\r';
case '\u2028' :
return '\\u2028';
case '\u2029' :
return '\\u2029';
}
})
},
})

;(function() {
define({
'escape_string' : function(str) {
return ('' + str).replace(/["'\\\n\r\u2028\u2029]/g, function(ch) {
switch(ch) {
case '"' :
case '\\' :
case "'" :
return '\\' + ch;
case '\n' :
return '\\n';
case '\r' :
return '\\r';
case '\u2028' :
return '\\u2028';
case '\u2029' :
return '\\u2029';
}
})
},

})
})()

0 comments on commit a059856

Please sign in to comment.