17 lines
354 B
JavaScript
17 lines
354 B
JavaScript
|
// adapted from https://gist.github.com/jed/964849
|
||
|
let fn = (function(anchor) {
|
||
|
return function(url) {
|
||
|
anchor.href = url;
|
||
|
let parts = {};
|
||
|
for (let prop in anchor) {
|
||
|
if ('' + anchor[prop] === anchor[prop]) {
|
||
|
parts[prop] = anchor[prop];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return parts;
|
||
|
};
|
||
|
})(document.createElement('a'));
|
||
|
|
||
|
export default fn;
|