getValue.js 794 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = getValue;
  6. var _postcssValueParser = require('postcss-value-parser');
  7. function getValue(values) {
  8. return (0, _postcssValueParser.stringify)({
  9. nodes: values.reduce((nodes, arg, index) => {
  10. arg.forEach((val, idx) => {
  11. if (idx === arg.length - 1 && index === values.length - 1 && val.type === 'space') {
  12. return;
  13. }
  14. nodes.push(val);
  15. });
  16. if (index !== values.length - 1) {
  17. nodes[nodes.length - 1].type = 'div';
  18. nodes[nodes.length - 1].value = ',';
  19. }
  20. return nodes;
  21. }, [])
  22. });
  23. }
  24. module.exports = exports['default'];