Comparing version 1.0.5 to 1.1.0
15
index.js
@@ -47,2 +47,6 @@ /*! | ||
attribute: 'src' | ||
}, | ||
styles: { | ||
selector: 'style', | ||
method: 'text' | ||
} | ||
@@ -68,10 +72,17 @@ }; | ||
let value = ''; | ||
if (chosenType.method && $element[chosenType.method]) { | ||
value = $element[chosenType.method](); | ||
} else if (chosenType.attribute) { | ||
value = $element.attr(chosenType.attribute); | ||
} | ||
if (raw) { | ||
return { | ||
$el: $element, | ||
value: $element.attr(chosenType.attribute) | ||
value | ||
}; | ||
} | ||
return $element.attr(chosenType.attribute); | ||
return value; | ||
}); | ||
@@ -78,0 +89,0 @@ } |
{ | ||
"name": "oust", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"author": "Addy Osmani <addyosmani@gmail.com> (https://addyosmani.com/)", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -49,2 +49,8 @@ # oust [![Build Status](https://github.com/addyosmani/oust/workflows/Tests/badge.svg)](https://github.com/addyosmani/oust/actions?workflow=Tests) [![dependencies Status](https://img.shields.io/david/addyosmani/oust.svg)](https://david-dm.org/addyosmani/oust) [![devDependencies Status](https://img.shields.io/david/dev/addyosmani/oust.svg)](https://david-dm.org/addyosmani/oust?type=dev) | ||
#### Extract style preload references `<link rel="preload" as="style">` | ||
```js | ||
const hrefs = oust(htmlString, 'preload'); | ||
``` | ||
#### Extract URL references `<a href>` | ||
@@ -62,2 +68,8 @@ | ||
#### Extract inline styles `<style>...</style>` | ||
```js | ||
const styles = oust(htmlString, 'styles'); | ||
``` | ||
#### Extract cheerio elements alongside the value | ||
@@ -86,3 +98,3 @@ | ||
`src` | not set | a valid HTML string to parse for references | ||
`type` | not set | one of `stylesheets`, `scripts`, `imports`, `links`, `images` | ||
`type` | not set | one of `stylesheets`, `scripts`, `imports`, `preload`, `styles`, `links`, `images` | ||
@@ -89,0 +101,0 @@ ## CLI |
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
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
18253
109
145