* 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)
| 18853 | * @return {string} the escaped key. |
| 18854 | */ |
| 18855 | function escape(key) { |
| 18856 | var escapeRegex = /[=:]/g; |
| 18857 | var escaperLookup = { |
| 18858 | '=': '=0', |
| 18859 | ':': '=2' |
| 18860 | }; |
| 18861 | var escapedString = ('' + key).replace(escapeRegex, function (match) { |
| 18862 | return escaperLookup[match]; |
| 18863 | }); |
| 18864 | |
| 18865 | return '$' + escapedString; |
| 18866 | } |
| 18867 | |
| 18868 | /** |
| 18869 | * TODO: Test that a single child and an array with one item have the same key |
no outgoing calls
no test coverage detected