<commit_before>'use strict';

var path = require('path');

/**
 * Ensure that `ext` is on the file object.
 */

module.exports = function(file, next) {
  file.ext = file.ext || file.data.src.ext || path.extname(file.path);
  next();
};
<commit_msg>fix ext middleware<commit_after>'use strict';

var path = require('path');
var utils = require('../utils');

/**
 * Ensure that `ext` is on the file object.
 */

module.exports = function ext_(file, next) {
  file.ext = file.ext || file.data.src.ext || path.extname(file.path);

  if (typeof file.ext === 'string') {
    file.ext = utils.formatExt(file.ext);
  }
  next();
};

{'fraction_non_alphanumeric': 0.19230769230769232, 'fraction_numerical': 0.0, 'mean_word_length': 3.5955882352941178, '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': '1318538', 'n_tokens_mistral': 216, 'n_tokens_neox': 218, 'n_words': 54}