Ensure that value is a string, before parsing

Need to ensure that value is a string, because if not then will thrown exception "value.indexOf is not a function".