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

Function escape

code/controlled-uncontrolled/public/app.js:18306–18317  ·  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

18304 * @return {string} the escaped key.
18305 */
18306function escape(key) {
18307 var escapeRegex = /[=:]/g;
18308 var escaperLookup = {
18309 '=': '=0',
18310 ':': '=2'
18311 };
18312 var escapedString = ('' + key).replace(escapeRegex, function (match) {
18313 return escaperLookup[match];
18314 });
18315
18316 return '$' + escapedString;
18317}
18318
18319/**
18320 * 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