* 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)
| 18213 | * @return {string} the escaped key. |
| 18214 | */ |
| 18215 | function escape(key) { |
| 18216 | var escapeRegex = /[=:]/g; |
| 18217 | var escaperLookup = { |
| 18218 | '=': '=0', |
| 18219 | ':': '=2' |
| 18220 | }; |
| 18221 | var escapedString = ('' + key).replace(escapeRegex, function (match) { |
| 18222 | return escaperLookup[match]; |
| 18223 | }); |
| 18224 | |
| 18225 | return '$' + escapedString; |
| 18226 | } |
| 18227 | |
| 18228 | /** |
| 18229 | * TODO: Test that a single child and an array with one item have the same key |
no outgoing calls
no test coverage detected