MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / escape

Function escape

code/dependency-injection-module-system/public/app.js:19033–19044  ·  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

19031 * @return {string} the escaped key.
19032 */
19033function escape(key) {
19034 var escapeRegex = /[=:]/g;
19035 var escaperLookup = {
19036 '=': '=0',
19037 ':': '=2'
19038 };
19039 var escapedString = ('' + key).replace(escapeRegex, function (match) {
19040 return escaperLookup[match];
19041 });
19042
19043 return '$' + escapedString;
19044}
19045
19046/**
19047 * TODO: Test that a single child and an array with one item have the same key

Callers 2

getComponentKeyFunction · 0.70
RFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected