* 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)
| 18341 | * @return {string} the escaped key. |
| 18342 | */ |
| 18343 | function escape(key) { |
| 18344 | var escapeRegex = /[=:]/g; |
| 18345 | var escaperLookup = { |
| 18346 | '=': '=0', |
| 18347 | ':': '=2' |
| 18348 | }; |
| 18349 | var escapedString = ('' + key).replace(escapeRegex, function (match) { |
| 18350 | return escaperLookup[match]; |
| 18351 | }); |
| 18352 | |
| 18353 | return '$' + escapedString; |
| 18354 | } |
| 18355 | |
| 18356 | /** |
| 18357 | * TODO: Test that a single child and an array with one item have the same key |
no outgoing calls
no test coverage detected