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

Version Path
trackler-2.2.1.44 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.43 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.42 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.41 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.40 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.39 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.38 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.37 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.36 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.35 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.34 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.33 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.32 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.31 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.30 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.29 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.28 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.27 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.26 tracks/typescript/exercises/anagram/anagram.example.ts
trackler-2.2.1.25 tracks/typescript/exercises/anagram/anagram.example.ts