Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /*jslint |
||
20 | function alpha2id(alpha) { |
||
21 | 'use strict'; |
||
22 | |||
23 | alpha = alpha.toLowerCase(); |
||
24 | |||
25 | if (/^[a-z]$/.test(alpha)) { |
||
26 | return alpha.charCodeAt(0) - 'a'.charCodeAt(0); |
||
27 | } |
||
28 | |||
29 | if (/^[a-z][0-9]$/.test(alpha)) { |
||
30 | return (alpha.charCodeAt(0) - 'a'.charCodeAt(0)) + 26 * (alpha.charCodeAt(1) - '0'.charCodeAt(0)); |
||
31 | } |
||
32 | |||
33 | return -1; |
||
34 | } |
||
35 |