Created
April 23, 2020 19:44
-
-
Save digitalbase/0bb6796e9773815b4b16f32d7fdf70fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/utils/referrer_detection.util.js | |
| const inbound = require('prezly-inbound'); | |
| module.exports = async(href, referrer) => { | |
| console.log('going extraction', href, referrer); | |
| return new Promise((resolve, reject) => { | |
| inbound.referrer.parse(href, referrer, (error, data) => { | |
| if (error) { | |
| reject(error); | |
| } else { | |
| if (data.referrer.type === 'internal') { | |
| resolve(null); | |
| } | |
| resolve(data); | |
| } | |
| }); | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment