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

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 0.4.0 to 0.5.0

22

cli.js
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var argv = require('minimist')(process.argv.slice(2));
var pkg = require('./package.json');
var oust = require('./');
const fs = require('fs');
const minimist = require('minimist');
const pkg = require('./package.json');
const oust = require('.');
const argv = minimist(process.argv.slice(2));
function printHelp() {

@@ -22,3 +24,3 @@ console.log([

console.log(pkg.version);
return;
process.exit(0);
}

@@ -28,9 +30,9 @@

printHelp();
return;
process.exit(0);
}
var file = argv._[0];
var type = argv._[1];
const file = argv._[0];
const type = argv._[1];
fs.readFile(file, function (err, data) {
fs.readFile(file, (err, data) => {
if (err) {

@@ -37,0 +39,0 @@ console.error('Error opening file:', err.message);

@@ -18,6 +18,6 @@ /*!

*/
'use strict';
var cheerio = require('cheerio');
var types = {
const cheerio = require('cheerio');
const types = {
stylesheets: {

@@ -36,4 +36,4 @@ selector: 'link[rel="stylesheet"]',

preload: {
selector: 'link[rel="preload"][as="style"]',
attribute: 'href'
selector: 'link[rel="preload"][as="style"]',
attribute: 'href'
},

@@ -50,3 +50,3 @@ links: {

module.exports = function (src, type) {
module.exports = (src, type) => {
if (!src || !type) {

@@ -56,6 +56,6 @@ throw new Error('`src` and `type` required');

var chosenType = types[type];
var $ = cheerio.load(src);
const chosenType = types[type];
const $ = cheerio.load(src);
return $(chosenType.selector).map(function (i, el) {
return $(chosenType.selector).map((i, el) => {
return $(el).attr(chosenType.attribute);

@@ -70,12 +70,13 @@ }).toArray();

var chosenType = types[type];
var $ = cheerio.load(src);
const chosenType = types[type];
const $ = cheerio.load(src);
return Array.prototype.map.call($(chosenType.selector), function(el) {
var $el = $(el);
return Array.prototype.map.call($(chosenType.selector), el => {
const $el = $(el);
return {
$el: $el,
$el,
value: $el.attr(chosenType.attribute)
}
};
});
};
{
"name": "oust",
"version": "0.4.0",
"author": "Addy Osmani <addyosmani@gmail.com> (http://addyosmani.com)",
"version": "0.5.0",
"author": "Addy Osmani <addyosmani@gmail.com> (https://addyosmani.com)",
"license": "Apache-2.0",

@@ -9,3 +9,3 @@ "description": "Extract URLs to stylesheets, scripts, links, images or HTML imports from HTML",

"type": "git",
"url": "https://github.com/addyosmani/oust.git"
"url": "git+https://github.com/addyosmani/oust.git"
},

@@ -28,7 +28,7 @@ "bugs": {

"dependencies": {
"cheerio": "^0.19.0",
"minimist": "^1.1.0"
"cheerio": "^0.22.0",
"minimist": "^1.2.0"
},
"devDependencies": {
"mocha": "*"
"mocha": "^5.2.0"
},

@@ -43,4 +43,4 @@ "keywords": [

"engines": {
"node": ">=0.10.0"
"node": ">=6"
}
}

@@ -1,2 +0,2 @@

# oust [![Build Status](https://travis-ci.org/addyosmani/oust.svg?branch=master)](https://travis-ci.org/addyosmani/oust)
# oust [![Build Status](https://img.shields.io/travis/addyosmani/oust/master.svg)](https://travis-ci.org/addyosmani/oust) [![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)

@@ -62,3 +62,4 @@ > Extract URLs to stylesheets, scripts, links, images or HTML imports from HTML

#### Extract cheerio elements alongside the value
Usefull for post processing/filtering as you get an array of matched elements
Usefull for post processing/filtering as you get an array of matched elements
with cheerio convenience syntax (e.g. `$el.attr()`)

@@ -65,0 +66,0 @@

Sorry, the diff of this file is not supported yet

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