Skip to content

Instantly share code, notes, and snippets.

@egoing
Created March 2, 2017 03:43
Show Gist options
  • Save egoing/eef281df71e319d982dc8dbee17baf65 to your computer and use it in GitHub Desktop.
Save egoing/eef281df71e319d982dc8dbee17baf65 to your computer and use it in GitHub Desktop.
function uniqify(target){
var cleaned = target.replace(/(^[ \t]*\n)/gm, "");
var cleanedArr = cleaned.split('\n');
var uniqued = cleanedArr.filter(function(item, pos) {
return cleanedArr.indexOf(item) == pos;
});
return uniqued.join('\n');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment