.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / remark-parse / lib / locate / link.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/remark-parse/lib/locate/link.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/remark-parse/lib/locate/link.js
new file mode 100644 (file)
index 0000000..0f16fd8
--- /dev/null
@@ -0,0 +1,16 @@
+'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;
+}