Created
July 10, 2018 15:23
-
-
Save knownasilya/d5756d452a4b751c36f79fa68dbbfee3 to your computer and use it in GitHub Desktop.
My Ember test helpers
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
| import { currentURL } from '@ember/test-helpers'; | |
| export default function getQp(name, url=currentURL()) { | |
| if (!url || !name) { | |
| return; | |
| } | |
| let [, qps] = url.split('?'); | |
| let pairs = qps.split('&'); | |
| let [found] = pairs.filter((item) => item.includes(`${name}=`)); | |
| if (found) { | |
| let [, value] = found.split('='); | |
| return value; | |
| } | |
| return; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment