All files / src/utils isStandardSyntaxProperty.js

100% Statements 10/10
100% Branches 10/10
100% Functions 1/1
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30    3x           100x 2x       98x 2x       96x 4x       92x 2x     90x    
import { endsWith } from "./endsWith";
 
const hasInterpolation = require("../utils/hasInterpolation");
/**
 * Check whether a property is standard
 */
export function isStandardSyntaxProperty(property /*: string*/) /*: boolean*/ {
  // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value))
  if (property[0] === "$") {
    return false;
  }
 
  // Less var (e.g. @var: x)
  if (property[0] === "@") {
    return false;
  }
 
  // Less append property value with space (e.g. transform+_: scale(2))
  if (endsWith(property, "+") || endsWith(property, "+_")) {
    return false;
  }
 
  // SCSS or Less interpolation
  if (hasInterpolation(property)) {
    return false;
  }
 
  return true;
}