How to use the node-sass.types.List function in node-sass

To help you get started, we’ve selected a few node-sass examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github carbon-design-system / carbon / packages / test-utils / scss.js View on Github external
if (value instanceof types.Color) {
    if (value.getA() !== 1) {
      const r = value.getR();
      const g = value.getG();
      const b = value.getB();
      const a = value.getA();
      return `rgba(${r}, ${g}, ${b}, ${a})`;
    }
    const hexcode = [value.getR(), value.getG(), value.getB()]
      .map(toHexString)
      .join('');
    return `#${hexcode}`;
  }

  if (value instanceof types.List) {
    const length = value.getLength();
    const list = [];

    for (let i = 0; i < length; i++) {
      list.push(convert(value.getValue(i)));
    }

    return list;
  }

  if (value instanceof types.Map) {
    const length = value.getLength();
    const map = {};

    for (let i = 0; i < length; i++) {
      const key = value.getKey(i).getValue();
github carbon-design-system / carbon / tools / jest / scss.js View on Github external
function convert(value) {
  if (value instanceof types.Boolean || value instanceof types.String) {
    return value.getValue();
  }

  if (value instanceof types.Number) {
    return `${value.getValue()}${value.getUnit()}`;
  }

  if (value instanceof types.List) {
    const length = value.getLength();
    const list = [];

    for (let i = 0; i < length; i++) {
      list.push(convert(value.getValue(i)));
    }

    return list;
  }

  if (value instanceof types.Map) {
    const length = value.getLength();
    const map = {};

    for (let i = 0; i < length; i++) {
      const key = value.getKey(i).getValue();
github carbon-design-system / carbon / packages / components / tools / jest / scss.js View on Github external
function convert(value) {
  if (value instanceof types.Boolean || value instanceof types.String) {
    return value.getValue();
  }

  if (value instanceof types.Number) {
    return `${value.getValue()}${value.getUnit()}`;
  }

  if (value instanceof types.List) {
    const length = value.getLength();
    const list = [];

    for (let i = 0; i < length; i++) {
      list.push(convert(value.getValue(i)));
    }

    return list;
  }

  if (value instanceof types.Map) {
    const length = value.getLength();
    const map = {};

    for (let i = 0; i < length; i++) {
      const key = value.getKey(i).getValue();