source: frontend/node_modules/terminal-link/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 837 bytes
Line 
1'use strict';
2const ansiEscapes = require('ansi-escapes');
3const supportsHyperlinks = require('supports-hyperlinks');
4
5const terminalLink = (text, url, {target = 'stdout', ...options} = {}) => {
6 if (!supportsHyperlinks[target]) {
7 // If the fallback has been explicitly disabled, don't modify the text itself.
8 if (options.fallback === false) {
9 return text;
10 }
11
12 return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
13 }
14
15 return ansiEscapes.link(text, url);
16};
17
18module.exports = (text, url, options = {}) => terminalLink(text, url, options);
19
20module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {target: 'stderr', ...options});
21
22module.exports.isSupported = supportsHyperlinks.stdout;
23module.exports.stderr.isSupported = supportsHyperlinks.stderr;
Note: See TracBrowser for help on using the repository browser.