@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
17 lines (14 loc) • 346 B
JavaScript
const createRel = ({
rel,
href,
external
}) => {
const relValues = rel ? rel.split(" ") : []; // add noopener whenever external
if (external && href) {
if (!relValues.includes("noopener")) {
relValues.push("noopener");
}
}
return relValues.length > 0 ? relValues.join(" ") : undefined;
};
export default createRel;