I'm trying to convert the following function to accept lines entered into an input field. It works fine if there are multiple lines, I'm reading the entries into an array if there is a line break "\n", but I can't figure out how to get it to format a single entry without the line break as an array item:

```
  const obj = {};
  Object.keys(value).map(function(data) {
    if (data !== 'submit') {
      const val: string = value[data].toString();
      let result = val;
      // this is accounting for line breaks
      if (val.indexOf('\n') > 0) {

        //multiple lines, being added into array correctly 
        result = JSON.parse(JSON.stringify(val.split('\n')));

      } else {

        //problem is here, need result as a single item in an array
        result = JSON.parse(JSON.stringify(val));
      }
      obj[data] = result;
    }
  });

```