Problem statement
Write function solution(text). Inputs and outputs are JSON values. Do not modify input arrays or objects. External libraries, network access, and asynchronous functions are not supported. text is valid CSV. Separator is comma; records use LF, CRLF or CR. A field may be fully double-quoted; inside it retain commas/newlines and unescape doubled quotes. Do not trim whitespace. A terminal record separator adds no phantom row. Empty text returns []; a blank record is ['']. Return arrays of field strings. Malformed CSV is outside the contract. Input limits: at most 50,000 items per input array and 1,000 characters per string. Numbers are finite; integers and accumulated integer results stay in the JavaScript safe-integer range. Other types and validity rules follow the statement above.
Example input and output
Example 1
Function arguments
[ "a,b\n1,2" ]
Return value
[
[
"a",
"b"
],
[
"1",
"2"
]
]Example 2
Function arguments
[ "\"a,b\",\"x\"\"y\"\r\n3,4" ]
Return value
[
[
"a,b",
"x\"y"
],
[
"3",
"4"
]
]Example 3
Function arguments
[ "서울,\"공백\"" ]
Return value
[
[
"서울",
"공백"
]
]