Socket
Socket
Sign inDemoInstall

oust

Package Overview
Dependencies
2
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.5.1

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 +26,3 @@ console.log([

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

@@ -28,9 +32,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 +41,0 @@ console.error('Error opening file:', err.message);

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

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

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

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

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

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

@@ -56,6 +58,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 +72,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.1",
"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"
},

@@ -25,10 +25,13 @@ "bugs": {

"scripts": {
"test": "mocha"
"mocha": "mocha",
"test": "npm run xo && npm run mocha",
"xo": "xo"
},
"dependencies": {
"cheerio": "^0.19.0",
"minimist": "^1.1.0"
"cheerio": "^0.22.0",
"minimist": "^1.2.0"
},
"devDependencies": {
"mocha": "*"
"mocha": "^5.2.0",
"xo": "^0.23.0"
},

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

"engines": {
"node": ">=0.10.0"
"node": ">=6"
},
"xo": {
"space": 4,
"rules": {
"valid-jsdoc": "off"
}
}
}

@@ -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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc