Crystal-Clear / codecrystal

A tool to create a visualisation of the file structure of your GitHub repo and display it as a badge in your READme
22 stars 2 forks source link

isAlphanumeric #25

Open rub1e opened 9 years ago

rub1e commented 9 years ago

https://github.com/Crystal-Clear/codecrystal/blob/master/d3/parser.js#L2-L4

not a huge fan of this function - seems like a lot of work for something quite simple - might want to tryn something more like this:

function str(c) {
    return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890".indexOf(c) >= 0;
}

I tested this and it takes 0.20ms compared to your 0.27ms