(param, base)
| 1204 | } |
| 1205 | |
| 1206 | function loadPatch(param, base) { |
| 1207 | if (typeof param === 'string') { |
| 1208 | if (/^@@/m.test(param) || /^Index:/m.test(param)) { |
| 1209 | return parsePatch(param)[0]; |
| 1210 | } |
| 1211 | |
| 1212 | if (!base) { |
| 1213 | throw new Error('Must provide a base reference or pass in a patch'); |
| 1214 | } |
| 1215 | |
| 1216 | return structuredPatch(undefined, undefined, base, param); |
| 1217 | } |
| 1218 | |
| 1219 | return param; |
| 1220 | } |
| 1221 | |
| 1222 | function fileNameChanged(patch) { |
| 1223 | return patch.newFileName && patch.newFileName !== patch.oldFileName; |
no test coverage detected