summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js')
-rw-r--r--tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js
new file mode 100644
index 0000000000..dab2a3c54f
--- /dev/null
+++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/locate/link.js
@@ -0,0 +1,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;
+}