MCPcopy Index your code
hub / github.com/apache/echarts / convertStringToJSLiteral

Function convertStringToJSLiteral

test/lib/testHelper.js:2440–2448  ·  view source on GitHub ↗
(str, quotationMark)

Source from the content-addressed store, hash-verified

2438 };
2439
2440 var convertStringToJSLiteral = function (str, quotationMark) {
2441 // assert(getType(str) === 'string');
2442 // assert(quotationMark === '"' || quotationMark === "'");
2443 str = JSON.stringify(str); // escapse \n\r or others.
2444 if (quotationMark === "'") {
2445 str = "'" + str.slice(1, str.length - 1).replace(/'/g, "\\'") + "'";
2446 }
2447 return str;
2448 }
2449
2450 /**
2451 * @usage

Callers 2

encodeJSObjectKeyFunction · 0.85
doPrintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…