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

Function escape

code/composition/public/app.js:19120–19131  ·  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

19118 * @return {string} the escaped key.
19119 */
19120function escape(key) {
19121 var escapeRegex = /[=:]/g;
19122 var escaperLookup = {
19123 '=': '=0',
19124 ':': '=2'
19125 };
19126 var escapedString = ('' + key).replace(escapeRegex, function (match) {
19127 return escaperLookup[match];
19128 });
19129
19130 return '$' + escapedString;
19131}
19132
19133/**
19134 * 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