.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / isStandardSyntaxValue.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/stylelint/lib/utils/isStandardSyntaxValue.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/stylelint/lib/utils/isStandardSyntaxValue.js
new file mode 100644 (file)
index 0000000..63cf88c
--- /dev/null
@@ -0,0 +1,32 @@
+/* @flow */
+"use strict";
+
+const hasInterpolation = require("../utils/hasInterpolation");
+/**
+ * Check whether a value is standard
+ */
+module.exports = function(value /*: string*/) /*: boolean*/ {
+  let normalizedValue = value;
+
+  // Ignore operators before variables (example -$variable)
+  if (/^[-+*/]/.test(value[0])) {
+    normalizedValue = normalizedValue.slice(1);
+  }
+
+  // SCSS variable
+  if (normalizedValue[0] === "$") {
+    return false;
+  }
+
+  // Less variable
+  if (normalizedValue[0] === "@") {
+    return false;
+  }
+
+  // SCSS or Less interpolation
+  if (hasInterpolation(normalizedValue)) {
+    return false;
+  }
+
+  return true;
+};