Codebase list node-nth-check / f978571
parse 0n properly fb55 9 years ago
2 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
2525
2626 if(parsed[1]){
2727 a = parseInt(parsed[1], 10);
28 if(!a){
28 if(isNaN(a)){
2929 if(parsed[1].charAt(0) === "-") a = -1;
3030 else a = 1;
3131 }
3636 parsed[3] ? parseInt((parsed[2] || "") + parsed[3], 10) : 0
3737 ];
3838 }
39 }
39 }
2626 "-1n+3": [ -1, 3 ],
2727 "-n+2": [ -1, 2 ],
2828 "-n+3": [ -1, 3 ],
29 "0n+3": [ 1, 3 ],
29 "0n+3": [ 0, 3 ],
3030 "1n": [ 1, 0 ],
3131 "1n+0": [ 1, 0 ],
3232 "2n": [ 2, 0 ],
9898 parseValid();
9999 process.stdout.write("X\n- check values: \t");
100100 testValid();
101 process.stdout.write("X\n");
101 process.stdout.write("X\n");