Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-equiv-refresh

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-equiv-refresh - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

34

index.js
"use strict";
var pattern = /^\s*(\d+)(?:\s*;(?:\s*url\s*=\s*)?(.+)?)?$/i;
var pattern = /^\s*(\d+)(?:\s*;(?:\s*url\s*=)?\s*(.+)?)?$/i;

@@ -8,2 +8,3 @@

{
var firstChar,lastChar,url;
var result = { timeout:null, url:null };

@@ -14,4 +15,31 @@ content = pattern.exec(content);

{
if (content[1] !== undefined) result.timeout = content[1] * 1; // faster than `parseInt()`
if (content[2] !== undefined) result.url = content[2].trim();
if (content[1] !== undefined)
{
result.timeout = ~~content[1]; // faster than `parseInt()`
}
if (content[2] !== undefined)
{
url = content[2].trim();
firstChar = url[0];
lastChar = url[ url.length-1 ];
// Remove a single level of encapsulating quotes
if (firstChar==="'" && lastChar==="'" || firstChar==='"' && lastChar==='"')
{
if (url.length > 2)
{
url = url.substr(1, url.length-2).trim();
}
else
{
url = "";
}
if (url === "") url = null;
}
result.url = url;
}
}

@@ -18,0 +46,0 @@

2

package.json
{
"name": "http-equiv-refresh",
"description": "Parse an HTML meta refresh value.",
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/stevenvachon/http-equiv-refresh",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc