* 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)
| 19031 | * @return {string} the escaped key. |
| 19032 | */ |
| 19033 | function escape(key) { |
| 19034 | var escapeRegex = /[=:]/g; |
| 19035 | var escaperLookup = { |
| 19036 | '=': '=0', |
| 19037 | ':': '=2' |
| 19038 | }; |
| 19039 | var escapedString = ('' + key).replace(escapeRegex, function (match) { |
| 19040 | return escaperLookup[match]; |
| 19041 | }); |
| 19042 | |
| 19043 | return '$' + escapedString; |
| 19044 | } |
| 19045 | |
| 19046 | /** |
| 19047 | * TODO: Test that a single child and an array with one item have the same key |
no outgoing calls
no test coverage detected