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

Function escape

code/redux/public/app.js:20326–20337  ·  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

20324 * @return {string} the escaped key.
20325 */
20326function escape(key) {
20327 var escapeRegex = /[=:]/g;
20328 var escaperLookup = {
20329 '=': '=0',
20330 ':': '=2'
20331 };
20332 var escapedString = ('' + key).replace(escapeRegex, function (match) {
20333 return escaperLookup[match];
20334 });
20335
20336 return '$' + escapedString;
20337}
20338
20339/**
20340 * TODO: Test that a single child and an array with one item have the same key

Callers 4

getComponentKeyFunction · 0.70
RFunction · 0.70
theme.jsFile · 0.50
gitbook.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected