share-this
Version:
Medium-like text selection sharing without dependencies
9 lines (7 loc) • 367 B
JavaScript
export default (options, sharers, text, rawText) => {
const refUrl = options.shareUrl || options.document.defaultView.location;
// eslint-disable-next-line prefer-template
return "<ul>"
+ sharers.map(sharer => `<li data-share-via="${sharer.name}">${sharer.render.call(sharer, text, rawText, refUrl)}</li>`).join("")
+ "</ul>";
};