MCPcopy Index your code
hub / github.com/microsoft/SandDance / escape

Function escape

docs/external/js/react.development.js:995–1005  ·  view source on GitHub ↗

* Escape and wrap key so it is safe to use as a reactid * * @param {string} key to be escaped. * @return {string} the escaped key.

(key)

Source from the content-addressed store, hash-verified

993 */
994
995 function escape(key) {
996 var escapeRegex = /[=:]/g;
997 var escaperLookup = {
998 '=': '=0',
999 ':': '=2'
1000 };
1001 var escapedString = ('' + key).replace(escapeRegex, function (match) {
1002 return escaperLookup[match];
1003 });
1004 return '$' + escapedString;
1005 }
1006 /**
1007 * TODO: Test that a single child and an array with one item have the same key
1008 * pattern.

Callers 5

createExportMethod · 0.85
getEmbedHTMLFunction · 0.85
createExportMethod · 0.85
getEmbedHTMLFunction · 0.85
getComponentKeyFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected