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

oust

Package Overview
Dependencies
Maintainers
1
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 0.3.0 to 0.4.0

17

index.js

@@ -60,1 +60,18 @@ /*!

};
module.exports.raw = function (src, type) {
if (!src || !type) {
throw new Error('`src` and `type` required');
}
var chosenType = types[type];
var $ = cheerio.load(src);
return Array.prototype.map.call($(chosenType.selector), function(el) {
var $el = $(el);
return {
$el: $el,
value: $el.attr(chosenType.attribute)
}
});
};

2

package.json
{
"name": "oust",
"version": "0.3.0",
"version": "0.4.0",
"author": "Addy Osmani <addyosmani@gmail.com> (http://addyosmani.com)",

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

@@ -29,2 +29,10 @@ # oust [![Build Status](https://travis-ci.org/addyosmani/oust.svg?branch=master)](https://travis-ci.org/addyosmani/oust)

#### Extract stylesheets references with media print `<link rel="stylesheet" media="print">`
```js
var hrefs = oust(htmlString, 'stylesheets', function(i, $el) {
return $el.attr('media') === 'print';
});
```
#### Extract script references `<script src>`

@@ -54,2 +62,17 @@

#### Extract cheerio elements alongside the value
Usefull for post processing/filtering as you get an array of matched elements
with cheerio convenience syntax (e.g. `$el.attr()`)
```js
var srcs = oust.raw(htmlString, '...');
-> [
{value: '...', $el: '...'},
{value: '...', $el: '...'},
...
]
```
## API

@@ -64,3 +87,2 @@

## CLI

@@ -67,0 +89,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