2020-05-19 11:43:42 +03:00

17 lines
341 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict'
module.exports = locate
function locate(value, fromIndex) {
var link = value.indexOf('[', fromIndex)
var image = value.indexOf('![', fromIndex)
if (image === -1) {
return link
}
// Link can never be `-1` if an image is found, so we dont need to check
// for that :)
return link < image ? link : image
}