From 535737ba721e90a4da1c4d76b62982f9ba3f23e7 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 22 Dec 2022 17:11:44 +0100 Subject: [PATCH] code cleanup --- packages/tools/src/filterName.ts | 54 -------------------------------- 1 file changed, 54 deletions(-) diff --git a/packages/tools/src/filterName.ts b/packages/tools/src/filterName.ts index 5df75603..81c1d0b8 100644 --- a/packages/tools/src/filterName.ts +++ b/packages/tools/src/filterName.ts @@ -6,60 +6,6 @@ export interface FilterNameDefinition { childName: string; } -// original C# variant -// public bool Match(string value) -// { -// if (String.IsNullOrEmpty(Filter)) return false; -// if (String.IsNullOrEmpty(value)) return true; - -// var camelVariants = new HashSet(); -// camelVariants.Add(new String(value.Where(Char.IsUpper).ToArray())); -// if (value.All(x => Char.IsUpper(x) || x == '_')) -// { -// var sb = new StringBuilder(); -// for (int i = 0; i < value.Length; i++) -// { -// if (Char.IsUpper(value[i]) && (i == 0 || value[i - 1] == '_')) sb.Append(value[i]); -// } -// camelVariants.Add(sb.ToString()); -// } -// else -// { -// string s = value, s0; -// do -// { -// s0 = s; -// s = Regex.Replace(s, "([A-Z])([A-Z])([A-Z])", "$1$3"); -// } while (s0 != s); -// camelVariants.Add(new String(s.Where(Char.IsUpper).ToArray())); -// } - -// bool camelMatch = camelVariants.Any(x => DoMatch(Filter, x)); -// if (Filter.All(Char.IsUpper)) return camelMatch; -// return DoMatch(Filter, value) || camelMatch; -// } - -// function fuzzysearch(needle, haystack) { -// var hlen = haystack.length; -// var nlen = needle.length; -// if (nlen > hlen) { -// return false; -// } -// if (nlen === hlen) { -// return needle === haystack; -// } -// outer: for (var i = 0, j = 0; i < nlen; i++) { -// var nch = needle.charCodeAt(i); -// while (j < hlen) { -// if (haystack.charCodeAt(j++) === nch) { -// continue outer; -// } -// } -// return false; -// } -// return true; -// } - function camelMatch(filter: string, text: string): boolean { if (!text) return false; if (!filter) return true;