extension.js 218 B

1234567891011
  1. const path = require('path');
  2. const EXTRE = /^[.]?[^.]+([.].*)$/;
  3. module.exports = function (input) {
  4. var extension = EXTRE.exec(path.basename(input));
  5. if (!extension) {
  6. return;
  7. }
  8. return extension[1];
  9. };