* Copies an object containing JSON data and returns it. * Returns null if input object contains invalid JSON (e.g. undefined or * circular references). * @param {?JsonObject|undefined} o * @return {?JsonObject}
(o)
| 1657 | * @return {?JsonObject} |
| 1658 | */ |
| 1659 | copyJsonObject_(o) { |
| 1660 | if (o === undefined) { |
| 1661 | return null; |
| 1662 | } |
| 1663 | try { |
| 1664 | return parseJson(JSON.stringify(o)); |
| 1665 | } catch (e) { |
| 1666 | dev().error(TAG, 'Failed to copy JSON (' + o + ') with error: ' + e); |
| 1667 | } |
| 1668 | return null; |
| 1669 | } |
| 1670 | |
| 1671 | /** |
| 1672 | * Print out the current state in the console. |
no test coverage detected