(uniDiff, options)
| 889 | } // Wrapper that supports multiple file patches via callbacks. |
| 890 | |
| 891 | function applyPatches(uniDiff, options) { |
| 892 | if (typeof uniDiff === 'string') { |
| 893 | uniDiff = parsePatch(uniDiff); |
| 894 | } |
| 895 | |
| 896 | var currentIndex = 0; |
| 897 | |
| 898 | function processIndex() { |
| 899 | var index = uniDiff[currentIndex++]; |
| 900 | |
| 901 | if (!index) { |
| 902 | return options.complete(); |
| 903 | } |
| 904 | |
| 905 | options.loadFile(index, function (err, data) { |
| 906 | if (err) { |
| 907 | return options.complete(err); |
| 908 | } |
| 909 | |
| 910 | var updatedContent = applyPatch(data, index, options); |
| 911 | options.patched(index, updatedContent, function (err) { |
| 912 | if (err) { |
| 913 | return options.complete(err); |
| 914 | } |
| 915 | |
| 916 | processIndex(); |
| 917 | }); |
| 918 | }); |
| 919 | } |
| 920 | |
| 921 | processIndex(); |
| 922 | } |
| 923 | |
| 924 | function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { |
| 925 | if (!options) { |
nothing calls this directly
no test coverage detected