Sha256: f1b0cfe204f26c7edb60c9a69672118a64f9c66ba39ed3b438cab765f21c4adf
Contents?: true
Size: 785 Bytes
Versions: 243
Compression:
Stored size: 785 Bytes
Contents
const aToZ = [...Array<string>(26)].map( ( _ , index) => { return String.fromCharCode(index + 65) }) class Panagram { 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 Panagram
Version data entries
243 entries across 243 versions & 1 rubygems