Browser throwing unresponsive popup after sometime while handling excel content by Papa -AngularJS

15 views
Skip to first unread message

Test convene

unread,
Jun 27, 2019, 7:28:41 AM6/27/19
to Angular and AngularJS discussion

can anybody response, To handle csv data papa parsing library using to convert read excel data, but while parsing browser is giving unresponsive after X minutes.

Here is the breaking lines of javascript code.

attached excel fine as well.


 function csvToJSON (data) {

            data = trimEmptyLastCSVLine(data);
            var parseResult = Papa.parse(data, {
                header: true,
                dynamicTyping: true
            });

            var jsonArray = trimJSONArray(parseResult.data); // script throw unreposnsive 

            return { data: jsonArray, header: parseResult.meta.fields};
        }

        /**
         * Trims any strings in the json output
         */
        function trimJSONArray(jsonArray) {
            return JSON.parse(JSON.stringify(jsonArray).replace(/"\s+|\s+"/g,'"')); // eslint-disable-line
        }

        function trimEmptyLastCSVLine(data) {
            if(angular.isString(data)) {
                return data.replace(/\r?\n(\s*,*)+\r?\n?$/g, ''); // ** mozilla thrown script error popup **
            }
        }
speakers-error-original.csv

Sander Elias

unread,
Jun 30, 2019, 1:26:19 AM6/30/19
to Angular and AngularJS discussion
Hi Test,

did you try braking it down into smaller steps? 

Regards
Sander
Reply all
Reply to author
Forward
0 new messages