build_config_name.js 461 B

1234567891011121314151617
  1. module.exports = function (opts) {
  2. opts = opts || {};
  3. var configName = opts.configName;
  4. var extensions = opts.extensions;
  5. if (!configName) {
  6. throw new Error('Please specify a configName.');
  7. }
  8. if (configName instanceof RegExp) {
  9. return [configName];
  10. }
  11. if (!Array.isArray(extensions)) {
  12. throw new Error('Please provide an array of valid extensions.');
  13. }
  14. return extensions.map(function (ext) {
  15. return configName + ext;
  16. });
  17. };