http-equiv-refresh
Advanced tools
Comparing version 1.0.0 to 2.0.0
13
index.js
"use strict"; | ||
var pattern = /^\s*(\d+)(?:\s*;(?:\s*url\s*=)?\s*(.+)?)?$/i; | ||
const pattern = /^\s*(\d+)(?:\s*;(?:\s*url\s*=)?\s*(.+)?)?$/i; | ||
@@ -8,4 +8,3 @@ | ||
{ | ||
var firstChar,lastChar,url; | ||
var result = { timeout:null, url:null }; | ||
const result = { timeout:null, url:null }; | ||
content = pattern.exec(content); | ||
@@ -17,3 +16,3 @@ | ||
{ | ||
result.timeout = ~~content[1]; // faster than `parseInt()` | ||
result.timeout = parseInt( content[1] ); | ||
} | ||
@@ -23,6 +22,6 @@ | ||
{ | ||
url = content[2].trim(); | ||
let url = content[2].trim(); | ||
firstChar = url[0]; | ||
lastChar = url[ url.length-1 ]; | ||
const firstChar = url[0]; | ||
const lastChar = url[ url.length-1 ]; | ||
@@ -29,0 +28,0 @@ // Remove a single level of encapsulating quotes |
{ | ||
"name": "http-equiv-refresh", | ||
"description": "Parse an HTML meta refresh value.", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
"homepage": "https://github.com/stevenvachon/http-equiv-refresh", | ||
"author": { | ||
"name": "Steven Vachon", | ||
"email": "contact@svachon.com", | ||
"url": "http://www.svachon.com/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/stevenvachon/http-equiv-refresh.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/stevenvachon/http-equiv-refresh/issues" | ||
}, | ||
"author": "Steven Vachon <contact@svachon.com> (https://www.svachon.com/)", | ||
"repository": "stevenvachon/http-equiv-refresh", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"mocha": "^2.4.5" | ||
"mocha": "^3.3.0" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10" | ||
"node": ">= 6" | ||
}, | ||
"scripts": { | ||
"test": "mocha test.js --reporter spec --check-leaks --bail" | ||
"test": "mocha test.js --reporter=spec --check-leaks --bail" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"license" | ||
], | ||
"files": ["index.js"], | ||
"keywords": [ | ||
@@ -34,0 +20,0 @@ "html", |
# http-equiv-refresh [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
> Parse an HTML meta refresh value. | ||
> Parse an HTML [meta refresh value](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#attr-http-equiv). | ||
@@ -8,3 +8,3 @@ | ||
[Node.js](http://nodejs.org/) `>= 0.10` is required. To install, type this at the command line: | ||
[Node.js](http://nodejs.org/) `>= 6` is required. To install, type this at the command line: | ||
```shell | ||
@@ -17,9 +17,9 @@ npm install http-equiv-refresh | ||
```js | ||
var parseMetaRefresh = require("http-equiv-refresh"); | ||
const parseMetaRefresh = require('http-equiv-refresh'); | ||
parseMetaRefresh("5; url=http://domain.com/"); | ||
//=> { timeout:5, url:"http://domain.com/" } | ||
parseMetaRefresh('5; url=http://domain.com/'); | ||
//-> { timeout:5, url:'http://domain.com/' } | ||
parseMetaRefresh("5"); | ||
//=> { timeout:5, url:null } | ||
parseMetaRefresh('5'); | ||
//-> { timeout:5, url:null } | ||
``` | ||
@@ -26,0 +26,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3416
36
2
1
1