{"ScriptPreparationCode":"line = \u00271,,\u0022\u0022\u0022Jillian\u0022,\u0022Pire\u0022\u0022,\u0022\u0022li\u0022,jpirelli0@seattletimes.com,\u0022Gender,fluid\u0022,\u0022\u0022,\u002293,164,220,186\u0022\u0027;","TestCases":[{"Name":"split","Code":"\r\n\tconst delimiter = \u0027,\u0027;\r\n\tconst wrapper = \u0027\u0022\u0027;\r\n\r\n\tconst tokens = line.split(delimiter);\r\n\tconst cells = [];\r\n\tlet inWrapper = false;\r\n\tlet tmp = \u0027\u0027;\r\n\tfor (let token of tokens) {\r\n\t\tif (inWrapper) {\r\n\t\t\ttoken = \u0060${tmp}${delimiter}${token}\u0060;\r\n\t\t\ttmp = \u0027\u0027;\r\n\t\t}\r\n\t\t\r\n\t\tconst sanitizedToken = token.replace(/\u0022{2}/g, \u0027\u0027);\r\n\t\tif (sanitizedToken[0] === wrapper) {\r\n\t\t\tinWrapper = true;\r\n\t\t\ttoken = token.slice(1);\r\n\t\t}\r\n\t\tif (sanitizedToken.slice(-1) === wrapper) {\r\n\t\t\tinWrapper = false;\r\n\t\t\ttoken = token.slice(0, -1);\r\n\t\t}\r\n\r\n\t\tif(inWrapper) {\r\n\t\t\ttmp = token;\r\n\t\t} else {\r\n\t\t\tcells.push(token.replace(/\u0022{2}/g, \u0027\u0022\u0027));\r\n\t\t}\r\n\t}\r\n\r\n \r\n","IsDeferred":false},{"Name":"loop","Code":"let delimiter = \u0027,\u0027;\r\n let wrapper = \u0027\u0022\u0027;\r\n\r\n let cells = [];\r\n let tmp = \u0027\u0027;\r\n let inWrapper = false;\r\n let previousChar = \u0027\u0027;\r\n for (let i = 0; i \u003C line.length; i\u002B\u002B) {\r\n if (line[i] === wrapper \u0026\u0026 line[i] === line[i\u002B1]) {\r\n tmp \u002B= wrapper\r\n i\u002B=2;\r\n }\r\n\r\n let char = line[i];\r\n let nextChar = line[i\u002B1];\r\n\r\n if((!previousChar || previousChar === delimiter) \u0026\u0026 char === wrapper) {\r\n inWrapper = true;\r\n continue;\r\n }\r\n if((!nextChar || nextChar === delimiter) \u0026\u0026 char === wrapper) {\r\n inWrapper = false;\r\n continue;\r\n }\r\n\r\n\r\n if(!inWrapper \u0026\u0026 char === delimiter) {\r\n cells.push(tmp);\r\n tmp = \u0027\u0027;\r\n } else {\r\n tmp \u002B= char\r\n }\r\n\r\n previousChar = char;\r\n }\r\n cells.push(tmp);","IsDeferred":false}]}