summary refs log tree commit diff
path: root/ReferenceClientProxyImplementation/Patches/Implementations/JSPatches/BooleanPropagationPatch.cs
blob: fe73c8e8eda080f6bfc6178d713068942dcb6c87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// using System.Text;
// using System.Text.RegularExpressions;
//
// namespace ReferenceClientProxyImplementation.Patches.Implementations.JSPatches;
//
// public partial class BooleanPropagationPatch : IPatch {
//     public int GetOrder() => 3;
//
//     public string GetName() => "Patch pointless boolean comparisons in JS";
//     public bool Applies(string relativeName, byte[] content) => relativeName.EndsWith(".js");
//
//     public async Task<byte[]> Execute(string relativePath, byte[] content) {
//         var stringContent = Encoding.UTF8.GetString(content);
//
//         stringContent = stringContent
//             .Replace(" && true", "").Replace(" || false", "").Replace("false || ", "")
//             ;
//
//         return Encoding.UTF8.GetBytes(stringContent);
//     }
// }