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

elfinder

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elfinder - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

23

element-finder.js

@@ -11,3 +11,3 @@ #!/usr/bin/env node

fs = require('fs'),
cheerio = require('cheerio'),
domtosource = require('domtosource'),
program = require('commander'),

@@ -54,3 +54,3 @@ list = function (val) {

// Print output in human readable format or JSON, depending on the ouput settings
output = function(info) {
output = function (info) {
if (program.json) {

@@ -157,3 +157,3 @@ console.log(JSON.stringify(info));

// Returns the first x lines of a string
trimLines = function(input, x) {
trimLines = function (input, x) {
var endIndex = 0,

@@ -173,5 +173,12 @@ nextIndex;

processFile = function (i, filePath) {
if (program.json) {
output({
'status' : 'processingFile',
'file' : filePath,
'fileNumber' : i + 1,
'numberOfFiles' : numberOfFiles
});
}
var data = fs.readFileSync(filePath, 'utf8'),
$ = cheerio.load(data),
matches = $(program.selector),
matches = domtosource.find(data, program.selector, true),
matchesLen = matches.length,

@@ -185,3 +192,7 @@ matchesDetails = [],

for (matchI = 0; matchI < matchesLen; matchI += 1) {
matchesDetails.push(trimLines(matches.eq(matchI).html(), 2));
matchesDetails.push({
'html' : trimLines(matches[matchI].html, 2),
'line' : matches[matchI].line,
'column' : matches[matchI].column
});
}

@@ -188,0 +199,0 @@ output({

{
"name" : "elfinder",
"version" : "0.2.0",
"version" : "0.3.0",
"description" : "Command line app for searching in HTML files for elements that match a CSS selector",

@@ -29,3 +29,3 @@ "keywords": ["html", "css", "find in files", "cli", "search", "find"],

"dependencies" : {
"cheerio" : "0.10.x",
"domtosource" : "0.0.x",
"commander" : "0.6.x"

@@ -32,0 +32,0 @@ },

@@ -28,3 +28,3 @@ var CLIeasy = require('cli-easy'),

.arg('-s "li"')
.expect('should find 12 matches in 4 files', /Found 12 matches in 4 files./)
.expect('should find 14 matches in 4 files', /Found 14 matches in 4 files./)
.undiscuss()

@@ -34,3 +34,3 @@

.arg('-s "li" -x "html"')
.expect('should find 9 matches in 3 files', /Found 9 matches in 3 files./)
.expect('should find 11 matches in 3 files', /Found 11 matches in 3 files./)
.undiscuss()

@@ -40,3 +40,3 @@

.arg('-s "li" -i "subfolder"')
.expect('should find 6 matches in 2 files', /Found 6 matches in 2 files./)
.expect('should find 8 matches in 2 files', /Found 8 matches in 2 files./)
.undiscuss()

@@ -46,3 +46,3 @@

.arg('-s ".colours > .awesome-list *:first-child"')
.expect('should find 1 match in 1 file', /Found 1 match in 1 file./)
.expect('should find 2 matches in 1 file', /Found 2 matches in 1 file./)
.undiscuss()

@@ -60,2 +60,7 @@

.discuss('testing elements inside elements')
.arg('-s ".green"')
.expect('should find 4 matches in 1 file', /Found 4 matches in 1 file./)
.undiscuss()
.discuss('testing a very large HTML page')

@@ -62,0 +67,0 @@ .arg('-x "largepage" -s "p"')

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