JSFiddle - React, Tailwind, and code Playground

JavaScript

text = ',34,23,4,5,634,23,12,5,4,3,1234,23,54,,,,,,,123,43,2,3,4,5,3424,,,,,,,,123,,,1234,,,,,,,45,,,56';
    text = text.replace(/,+/g, ',');
    text = $.trim(text);
    text = $.unique(text.split(",")).filter(function(e){ return e.length}).join(",");
    console.log(text);