Finally finished giant ES6 refactor

This commit is contained in:
Jonathan Cremin 2015-08-20 23:22:57 +01:00
parent c6d48cc424
commit 03e2666958
39 changed files with 553 additions and 635 deletions

View file

@ -1,19 +1,18 @@
"use strict";
var parse = require('url').parse;
import { parse } from 'url';
module.exports.match = function(url) {
export function* match(url) {
var parsed = parse(url.replace(/\+/g, "%20"));
if (!parsed.host.match(/play\.google\.com$/)) {
return false;
}
var path = parsed.path;
var hash = parsed.hash;
const path = parsed.path;
const hash = parsed.hash;
if (hash) {
var parts = hash.split("/");
var id = parts[2];
var artist = parts[3];
const parts = hash.split("/");
const id = parts[2];
const artist = parts[3];
if (id.length > 0) {
return true;
@ -21,7 +20,7 @@ module.exports.match = function(url) {
return true;
}
} else if(path) {
var matches = path.match(/\/music\/m\/([\w]+)/);
const matches = path.match(/\/music\/m\/([\w]+)/);
if (matches[1]) {
return true
}