microdata-node
Version:
Microdata to json and json-ld parser
16 lines (14 loc) • 327 B
JavaScript
/**
* splits a string on whitespaces and removes duplicate values
* @param {string} string
* @returns {string[]}
*/
function splitUnique (string) {
string = string && string.trim();
if (string) {
return Array.from(new Set((string.split(/\s+/))));
} else {
return [];
}
}
exports.splitUnique = splitUnique;