Sha256: 02753bfb5e8f3a8191fb9c82b4e83a3fded88d02e01a6aadce87f6ceb67211f5
Contents?: true
Size: 571 Bytes
Versions: 241
Compression:
Stored size: 571 Bytes
Contents
function sort(input: string): string { return input.toString().toLowerCase().split("").sort().join("") } class Anagram { value: string constructor(input: string) { this.value = input } matches(...input: string[]): string[] { const result: string[] = [] for (const each of input) { if ( sort(each) === sort(this.value) ) { if (each.toLowerCase() === this.value.toLowerCase()) {continue} result.push(each) } } return result } } export default Anagram
Version data entries
241 entries across 241 versions & 1 rubygems