<commit_before>'use strict';

var repeat = require('repeat-string');

/**
 * Create a markdown-formatted listitem.
 *
 * ```js
 * utils.item('Level 0 list item', 0);
 * //=> '* Level 0 list item'
 *
 * utils.item('Level 1 list item', 1);
 * //=> '  * Level 1 list item'
 *
 * utils.item('Level 2 list item', 2);
 * //=> '    * Level 2 list item'
 * ```
 *
 * @name listitem
 * @param  {String} `str`
 * @param  {Number} `level`
 * @param  {String} `options`
 *   @option  {String} `bullets` Array of bullets to use. Default `['-', '*', '+', '~']`
 *   @option  {Number} `highest` The highest level heading in the list.
 * @api public
 */

module.exports = function listitem(str, level, options) {
  var opts = options || {};
  var ch = opts.bullets || ['-', '*', '+', '~'];
  var lvl = level - opts.highest;

  var depth = lvl > 0
    ? repeat('  ', lvl)
    : '';

  var bullet = ch[(lvl) % ch.length];
  return depth
    + (bullet ? bullet : '*')
    + ' ' + str;
};<commit_msg>ensure that list items indent properly<commit_after>'use strict';

var repeat = require('repeat-string');

/**
 * Create a markdown-formatted listitem.
 *
 * ```js
 * utils.item('Level 0 list item', 0);
 * //=> '* Level 0 list item'
 *
 * utils.item('Level 1 list item', 1);
 * //=> '  * Level 1 list item'
 *
 * utils.item('Level 2 list item', 2);
 * //=> '    * Level 2 list item'
 * ```
 *
 * @name listitem
 * @param  {String} `str`
 * @param  {Number} `level`
 * @param  {String} `options`
 *   @option {String} [option] `bullets` Array of bullets to use. Default `['-', '*', '+', '~']`
 *   @option {Number} [option] `highest` The highest level heading in the list.
 *   @option {String} [option] `first` The string to use for indenting when the level is zero.
 * @api public
 */

module.exports = function listitem(str, level, options) {
  var opts = options || {};
  var ch = opts.bullets || ['-', '*', '+', '~'];
  var lvl = level - (+opts.highest || 0);

  // first indent.
  var first = opts.first || '';

  // indent depth
  var depth = (lvl > 0)
    ? repeat(' ', lvl)
    : first;

  var bullet = ch[(lvl) % ch.length];
  return depth
    + (bullet ? bullet : '*')
    + (' ' + str);
};
{'fraction_non_alphanumeric': 0.20733944954128442, 'fraction_numerical': 0.00963302752293578, 'mean_word_length': 2.880782918149466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3573373', 'n_tokens_mistral': 795, 'n_tokens_neox': 756, 'n_words': 229}