All files / src/lib createName.js

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14    1x 5x 5x 5x       5x        
import url from 'url';
 
const createName = (address) => {
  const { hostname, pathname } = url.parse(address);
  const regExpRepl = /[^0-9a-z]/gi;
  const newName = url.format({
    hostname: hostname.replace(regExpRepl, '-'),
    pathname: pathname.replace(regExpRepl, '-'),
  });
  return [`${newName}.html`, `${newName}_file`];
};
 
export default createName;