MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / escape

Function escape

code/dependency-injection/public/app.js:19075–19086  ·  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

19073 * @return {string} the escaped key.
19074 */
19075function escape(key) {
19076 var escapeRegex = /[=:]/g;
19077 var escaperLookup = {
19078 '=': '=0',
19079 ':': '=2'
19080 };
19081 var escapedString = ('' + key).replace(escapeRegex, function (match) {
19082 return escaperLookup[match];
19083 });
19084
19085 return '$' + escapedString;
19086}
19087
19088/**
19089 * 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