File size: 304 Bytes
e1cdf48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import last from 'licia/last'
import trim from 'licia/trim'
import Url from 'licia/Url'

export function getFileName(url) {
  let ret = last(url.split('/'))

  if (ret.indexOf('?') > -1) ret = trim(ret.split('?')[0])

  if (ret === '') {
    url = new Url(url)
    ret = url.hostname
  }

  return ret
}