diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-01 19:45:15 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-01 19:45:15 +0200 |
| commit | 36cda707b6b03a7b2aa10e6b17ca780797916060 (patch) | |
| tree | 34201825d669ef8d7693fde893be4a8266d5e9b1 /client/util/index.js | |
| parent | 83858f95425278d44e7f39177e141e7b82c0022c (diff) | |
test csv
Diffstat (limited to 'client/util/index.js')
| -rw-r--r-- | client/util/index.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/client/util/index.js b/client/util/index.js index 87d32ebb..e90e5466 100644 --- a/client/util/index.js +++ b/client/util/index.js @@ -63,6 +63,15 @@ export const percent = n => (n * 100).toFixed(1) + '%' export const px = (n, w) => Math.round(n * w) + 'px' export const clamp = (n, a, b) => n < a ? a : n < b ? n : b +export const domainFromUrl = url => { + const partz = url.split('/')[2].split('.') + if (partz.length > 2 && partz[partz.length - 2].length == 2) { + return partz.slice(-3).join('.') + } else { + return partz.slice(-2).join('.') + } +} + /* URLs */ export const preloadImage = opt => { |
