blob: dab2a3c54f17746c6fb9fb4c982f22dcf13a0e3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module remark:parse:locate:link
* @fileoverview Locate a link.
*/
'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 don’t need
* to check for that :) */
return link < image ? link : image;
}
|