Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / remark-stringify / lib / util / entity-prefix-length.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/remark-stringify/lib/util/entity-prefix-length.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/remark-stringify/lib/util/entity-prefix-length.js
new file mode 100644 (file)
index 0000000..488bb12
--- /dev/null
@@ -0,0 +1,23 @@
+'use strict';
+
+var decode = require('parse-entities');
+
+module.exports = length;
+
+/* Returns the length of HTML entity that is a prefix of
+ * the given string (excluding the ampersand), 0 if it
+ * does not start with an entity. */
+function length(value) {
+  var prefix;
+
+  /* istanbul ignore if - Currently also tested for at
+   * implemention, but we keep it here because that’s
+   * proper. */
+  if (value.charAt(0) !== '&') {
+    return 0;
+  }
+
+  prefix = value.split('&', 2).join('&');
+
+  return prefix.length - decode(prefix).length;
+}