Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function images (content) {
var pattern = /^!\[.*?\]\((.*)\)/mg
var notIterm = !/^iterm/i.test(process.env.TERM_PROGRAM)
var match
var image
if (notIterm) {
return content
}
while (match = pattern.exec(content)) {
try {
var url = path.join(path.dirname(file), match[1])
image = imgcat(fs.readFileSync(url))
content = content.replace(match[0], image)
} catch (error) {
// Either file doesn't exist
// or terminal doesn't support images
}
}
return content;
}
if (process.env.TERM_PROGRAM !== 'iTerm.app') {
return fallback;
}
const version = iterm2Version();
if (Number(version[0]) < 3) {
return fallback;
}
if (typeof image === 'string') {
image = fs.readFileSync(image);
}
return ansiEscapes.image(image, options);
}
}
}
}
}
this.cleared = false
this.current = frameNumber
this.lastSet = Date.now()
this.prevOptions = opts
var content
if (this.fallback) {
content = this.fallbackFrames[frameNumber]
} else {
content = ansiEscapes.image(this.frames[frameNumber], opts)
}
if (opts.textTop) {
content = opts.textTop + '\n' + content
}
if (opts.textBottom) {
content += '\n' + opts.textBottom
}
this.log(content)
return this
}