<commit_before>const postcss = require('postcss');
const getLineHeight = require('./lib/getLineHeight');
const lhToRem = require('./lib/lhToRem');

const defaults = {
  rootSelector: ':root',
  rhythmUnit: 'lh',
  lineHeight: 1.5
};

module.exports = postcss.plugin('postcss-lh', (opts = defaults) => {
  const options = Object.assign(defaults, opts)

  return (css) => {
    const lineHeight = getLineHeight(css, options) || options.lineHeight;
    const lhReg = new RegExp('\\d*\\.?\\d+' + options.rhythmUnit, 'gi');

    css.replaceValues(lhReg, {fast: options.rhythmUnit}, (val) => {
      return lhToRem(parseFloat(val), lineHeight);
    });
  };
});
<commit_msg>replace default parameters for node < 6 (#14)<commit_after>const postcss = require('postcss');
const getLineHeight = require('./lib/getLineHeight');
const lhToRem = require('./lib/lhToRem');

const defaults = {
  rootSelector: ':root',
  rhythmUnit: 'lh',
  lineHeight: 1.5
};

module.exports = postcss.plugin('postcss-lh', (opts) => {
  opts = opts === undefined ? defaults : opts;
  const options = Object.assign(defaults, opts)

  return (css) => {
    const lineHeight = getLineHeight(css, options) || options.lineHeight;
    const lhReg = new RegExp('\\d*\\.?\\d+' + options.rhythmUnit, 'gi');

    css.replaceValues(lhReg, {fast: options.rhythmUnit}, (val) => {
      return lhToRem(parseFloat(val), lineHeight);
    });
  };
});

{'fraction_non_alphanumeric': 0.18091168091168092, 'fraction_numerical': 0.004985754985754986, 'mean_word_length': 4.18450184501845, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '269504', 'n_tokens_mistral': 481, 'n_tokens_neox': 470, 'n_words': 100}