* 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)
| 20324 | * @return {string} the escaped key. |
| 20325 | */ |
| 20326 | function 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 |
no outgoing calls
no test coverage detected