papandreou / subset-font

Create a subset of a TrueType/OpenType/WOFF/WOFF2 font using the wasm build of harfbuzz/hb-subset
BSD 3-Clause "New" or "Revised" License
85 stars 6 forks source link

Simplify characters iteration #4

Closed ebraminio closed 3 years ago

ebraminio commented 3 years ago

Just to illustrate the issue better,

let text = '👌'; for (let i = 0; i < text.length; i += 1) { console.log(text[i]); } // FAIL: prints two incorrect characters [...text].forEach(c => console.log(c)) // PASS: prints one character for (const c of [...text]) { console.log(c); } // PASS for (const c of text) { console.log(c); } // PASS

Also curious to know why https://github.com/papandreou/subset-font/commit/84ac1955987f5197b0f037d6cf0dde1622d73397 was needed yet this won't revert that and just simplifies it.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 806572052


Totals Coverage Status
Change from base Build 765171076: 0.0%
Covered Lines: 36
Relevant Lines: 36

💛 - Coveralls
papandreou commented 3 years ago

Ah, you're right that the spread isn't necessary, thanks 🎉

I added 84ac195 because forEach is "old school" now that we have for...of, not because there was a functional problem with it.

papandreou commented 3 years ago

Released in 1.2.1.