| 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;
|