mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-12 08:38:10 +00:00
Merge pull request #251 from thewhodidthis/bf#246--line-breaks
data/TrialHandler: allow for doubly escaped LFs in xlsx cells
This commit is contained in:
commit
5374d199e3
@ -485,10 +485,20 @@ export class TrialHandler extends PsychObject
|
||||
value = arrayMaybe;
|
||||
}
|
||||
|
||||
// if value is a numerical string, convert it to a number:
|
||||
if (typeof value === 'string' && !isNaN(value))
|
||||
if (typeof value === 'string')
|
||||
{
|
||||
value = Number.parseFloat(value);
|
||||
const numberMaybe = Number.parseFloat(value);
|
||||
|
||||
// if value is a numerical string, convert it to a number:
|
||||
if (!isNaN(numberMaybe) && numberMaybe.toString().length === value.length)
|
||||
{
|
||||
value = numberMaybe;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse doubly escaped line feeds
|
||||
value = value.replace(/(\n)/g, '\n');
|
||||
}
|
||||
}
|
||||
|
||||
trial[fields[l]] = value;
|
||||
|
Loading…
Reference in New Issue
Block a user