Socket
Socket
Sign inDemoInstall

oust

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oust - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

15

index.js

@@ -60,13 +60,19 @@ /*!

const validTypes = Object.keys(types);
const typeArray = Array.isArray(type) ? type : [type];
if (!validTypes.includes(type)) {
throw new Error(`Invalid \`type\` value "${type}". Choose one of: ${validTypes.join(', ')}`);
for (const type of typeArray) {
if (!validTypes.includes(type)) {
throw new Error(`Invalid \`type\` value "${type}". Choose one of: ${validTypes.join(', ')}`);
}
}
const chosenType = types[type];
const chosenTypes = typeArray.map(type => ({...types[type], type}));
const selector = chosenTypes.map(type => type.selector).join(', ');
const $ = cheerio.load(src);
return Array.prototype.map.call($(chosenType.selector), element => {
return Array.prototype.map.call($(selector), element => {
const $element = $(element);
const chosenType = chosenTypes.find(type => $element.is(type.selector));
let value = '';

@@ -82,2 +88,3 @@ if (chosenType.method && $element[chosenType.method]) {

$el: $element,
type: chosenType.type,
value

@@ -84,0 +91,0 @@ };

{
"name": "oust",
"version": "1.1.0",
"version": "1.2.0",
"author": "Addy Osmani <addyosmani@gmail.com> (https://addyosmani.com/)",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -73,2 +73,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 preload and stylesheet references combined
```js
const hrefs = oust(htmlString, ['preload', 'stylesheets']);
```
#### Extract cheerio elements alongside the value

@@ -75,0 +81,0 @@

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