summaryrefslogtreecommitdiff
path: root/node_modules/http-equiv-refresh/index.js
blob: 47f3f941068af6ff829349cbd0e7fd5178bcf6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const PATTERN = /^\s*(\d+)(?:\s*;(?:\s*url\s*=)?\s*(?:["']\s*(.*?)\s*['"]|(.*?)))?\s*$/i;



export default content =>
{
	content = PATTERN.exec(content);

	let timeout, url;

	if (content !== null)
	{
		timeout = parseInt(content[1], 10);

		url = content[2] || content[3] || null; // first matching group
	}
	else
	{
		timeout = null;
		url = null;
	}

	return { timeout, url };
};