Sha256: f858b9bfbcd99ff62c9a42db083f61d3fd2847364c3cf54a665c74eaae443ba3
Contents?: true
Size: 784 Bytes
Versions: 52
Compression:
Stored size: 784 Bytes
Contents
const aToZ = [...Array<string>(26)].map( ( _ , index) => { return String.fromCharCode(index + 65) }) class Pangram { value: string constructor(input: string = "") { this.value = input } isPangram(): boolean { // create dictionay and fill it with the alphabet const myMap = new Map<string, number>() aToZ.forEach((key: string) => { myMap.set(key.toLowerCase(), 0) }) for (const each of this.value) { const value = myMap.get(each) || 0 myMap.set(each.toLowerCase(), value + 1 ) } for (const each of myMap.values()) { if (each === 0 ) { return false } } return true } } export default Pangram
Version data entries
52 entries across 52 versions & 1 rubygems