link-types
Advanced tools
Comparing version 2.0.0 to 3.0.0
25
index.js
@@ -5,29 +5,20 @@ "use strict"; | ||
function linkTypes(attrValue) | ||
{ | ||
return split(attrValue).filter(type => type !== ""); | ||
} | ||
const linkTypes = attrValue => split(attrValue).filter(type => type !== ""); | ||
function map(attrValue) | ||
const map = attrValue => split(attrValue).reduce((result, type) => | ||
{ | ||
return split(attrValue).reduce( function(result, type) | ||
if (type !== "") | ||
{ | ||
if (type !== "") | ||
{ | ||
result[type] = true; | ||
} | ||
result[type] = true; | ||
} | ||
return result; | ||
return result; | ||
}, {}); | ||
} | ||
}, {}); | ||
function split(attrValue) | ||
{ | ||
return attrValue.trim().toLowerCase().split(" "); | ||
} | ||
const split = attrValue => attrValue.trim().toLowerCase().split(" "); | ||
@@ -34,0 +25,0 @@ |
{ | ||
"name": "link-types", | ||
"description": "Parse an HTML attribute value containing link types.", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"license": "MIT", | ||
"author": "Steven Vachon <contact@svachon.com> (https://www.svachon.com/)", | ||
"repository": "stevenvachon/link-types", | ||
"author": "Steven Vachon <contact@svachon.com> (https://svachon.com)", | ||
"repository": "github:stevenvachon/link-types", | ||
"browser": "index-es5.js", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"mocha": "^3.3.0" | ||
"@babel/cli": "^7.4.3", | ||
"@babel/core": "^7.4.3", | ||
"@babel/preset-env": "^7.4.3", | ||
"chai": "^4.2.0", | ||
"mocha": "^6.1.4" | ||
}, | ||
"engines": { | ||
"node": ">= 6" | ||
"node": ">= 8" | ||
}, | ||
"scripts": { | ||
"test": "mocha test.js --reporter=spec --check-leaks --bail" | ||
"prepublish": "babel index.js --out-file=index-es5.js --presets=@babel/env --source-maps", | ||
"test": "mocha test.js --check-leaks --bail" | ||
}, | ||
"files": ["index.js"], | ||
"files": [ | ||
"index.js", | ||
"index-es5.js", | ||
"index-es5.js.map" | ||
], | ||
"keywords": [ | ||
@@ -20,0 +29,0 @@ "html", |
@@ -11,3 +11,3 @@ # link-types [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
[Node.js](http://nodejs.org/) `>= 6` is required. To install, type this at the command line: | ||
[Node.js](http://nodejs.org/) `>= 8` is required. To install, type this at the command line: | ||
```shell | ||
@@ -24,3 +24,3 @@ npm install link-types | ||
//-> ['nofollow'] | ||
linkTypes(' tag NOFOLLOW '); | ||
@@ -35,4 +35,4 @@ //-> ['tag', 'nofollow'] | ||
[npm-image]: https://img.shields.io/npm/v/link-types.svg | ||
[npm-url]: https://npmjs.org/package/link-types | ||
[npm-url]: https://npmjs.com/package/link-types | ||
[travis-image]: https://img.shields.io/travis/stevenvachon/link-types.svg | ||
[travis-url]: https://travis-ci.org/stevenvachon/link-types |
4785
6
32
5