'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.clean = clean;

var _limax = require('limax');

var _limax2 = _interopRequireDefault(_limax);

var _path = require('path');

var _path2 = _interopRequireDefault(_path);

var _ = require('../../');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function clean(str) {

  if (typeof str === 'undefined' || str === null) return null;
  str = str.split(_path2.default.sep);
  str[str.length - 1] = slugify(decodeURIComponent(str[str.length - 1]));
  return str.join('/');
}

function slugify(str) {
  str = str.replace(/\..+$/, '');
  str = (0, _limax2.default)(str, { separateNumbers: false });
  str = str + '.' + _.config.files.templates.extension;
  return str.toLowerCase();
}