.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / remark-parse / lib / locate / url.js
1 'use strict';
2
3 module.exports = locate;
4
5 var PROTOCOLS = ['https://', 'http://', 'mailto:'];
6
7 function locate(value, fromIndex) {
8   var length = PROTOCOLS.length;
9   var index = -1;
10   var min = -1;
11   var position;
12
13   if (!this.options.gfm) {
14     return -1;
15   }
16
17   while (++index < length) {
18     position = value.indexOf(PROTOCOLS[index], fromIndex);
19
20     if (position !== -1 && (position < min || min === -1)) {
21       min = position;
22     }
23   }
24
25   return min;
26 }