Replaces a key in a Commit. Ignores it if it's not there
( o: Commit | CommitPreSigned, oldKey: string, newKey: string, )
| 96 | |
| 97 | /** Replaces a key in a Commit. Ignores it if it's not there */ |
| 98 | function replaceKey( |
| 99 | o: Commit | CommitPreSigned, |
| 100 | oldKey: string, |
| 101 | newKey: string, |
| 102 | ) { |
| 103 | if (oldKey in o && oldKey !== newKey) { |
| 104 | Object.defineProperty( |
| 105 | o, |
| 106 | newKey, |
| 107 | Object.getOwnPropertyDescriptor(o, oldKey), |
| 108 | ); |
| 109 | delete o[oldKey]; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Takes a commit and serializes it deterministically (canonicilaization). Is |
no outgoing calls
no test coverage detected