c8fba0dcacb747d321f5ecf6ab3cbf229ca4d92d
[platform/framework/web/crosswalk-tizen.git] /
1 /** Used to escape characters for inclusion in compiled string literals. */
2 var stringEscapes = {
3   '\\': '\\',
4   "'": "'",
5   '\n': 'n',
6   '\r': 'r',
7   '\u2028': 'u2028',
8   '\u2029': 'u2029'
9 };
10
11 /**
12  * Used by `_.template` to escape characters for inclusion in compiled
13  * string literals.
14  *
15  * @private
16  * @param {string} chr The matched character to escape.
17  * @returns {string} Returns the escaped character.
18  */
19 function escapeStringChar(chr) {
20   return '\\' + stringEscapes[chr];
21 }
22
23 module.exports = escapeStringChar;