fix posFromString

This commit is contained in:
Romain Beaumont 2016-01-08 22:27:14 +01:00
parent e7fe4d5051
commit c861ac14b9

View file

@ -296,8 +296,8 @@ module.exports.server = function(serv) {
};
serv.posFromString = (str, pos) => {
if (parseInt(str)) return parseInt(str);
if (str.match(/~-?\d+/)) return parseInt(str.slice(1)) + pos;
if (str.indexOf("~")==-1) return parseFloat(str);
if (str.match(/~-?\d+/)) return parseFloat(str.slice(1)) + pos;
else if (str == '~') return pos;
else throw new UserError('Invalid position');
};