<commit_before>var fs = require('fs');
var path = require('path');
var semver = require('semver');

module.exports = function(bump, filename, nosave) {
  filename = filename || 'package.json';
  filename = path.join(process.cwd(), filename);
  var package_file = JSON.parse(fs.readFileSync(filename));
  var version = semver.valid(package_file.version);
  if (version) {
    if (bump) {
      if (nosave == false) {
        package_file.version = semver.inc(version, bump);
        fs.writeFileSync(filename, JSON.stringify(package_file, null, '  '));
      }
      return { from: version, to: package_file.version, bump: bump };
    } else {
      return version;
    }<commit_msg>version - increment version fix<commit_after>var fs = require('fs');
var path = require('path');
var semver = require('semver');

module.exports = function(bump, filename, nosave) {
  filename = filename || 'package.json';
  filename = path.join(process.cwd(), filename);
  var package_file = JSON.parse(fs.readFileSync(filename));
  var version = semver.valid(package_file.version);
  if (version) {
    if (bump) {
      package_file.version = semver.inc(version, bump);
      if (nosave == false) {
        fs.writeFileSync(filename, JSON.stringify(package_file, null, '  '));
      }
      return { from: version, to: package_file.version, bump: bump };
    } else {
      return version;
    }
{'fraction_non_alphanumeric': 0.14855072463768115, 'fraction_numerical': 0.0, 'mean_word_length': 3.634228187919463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '460464', 'n_tokens_mistral': 431, 'n_tokens_neox': 427, 'n_words': 99}