Socket
Socket
Sign inDemoInstall

css-revealer

Package Overview
Dependencies
37
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

28

lib/parseStylesheet.js

@@ -5,29 +5,17 @@ 'use strict';

var css = require('css');
var split = require('./util').split;
var head = require('./util').head;
var test = require('./util').test;
var concat = require('./util').concat;
var prop = require('./util').prop;
var propEq = require('./util').propEq;
var match = require('./util').match;
module.exports = function parse(stylesheet) {
var ast = css.parse(stylesheet);
var astRules = ast.stylesheet.rules;
return _.chain(astRules)
return _.chain(css.parse(stylesheet))
.at('stylesheet')
.map(prop('rules'))
.flatten()
.filter(propEq('type', 'rule'))
.map(prop('selectors'))
.reduce(concat, [])
.map(split(' '))
.reduce(function(memo, array){
return memo.concat(
array
.filter(test(/^[#.]/))
.map(_.compose(head, split(':')))
.map(split(/([.#][^.#]+)/g))
.reduce(concat, [])
.filter(test(/[^\s]/))
);
}, [])
.flatten()
.map(match(/([.#][^.#: ]+)/g))
.flatten()
.uniq()

@@ -34,0 +22,0 @@ .value();

@@ -6,16 +6,4 @@ 'use strict';

exports.readFile = _.partial(fs.readFile, _, { encoding: 'utf-8' });
exports.readFile = _.curry(fs.readFile, _, { encoding: 'utf-8' });
exports.split = _.curry(function(pattern, string){
return string.split(pattern);
});
exports.head = _.curry(function(list){
return list[0];
});
exports.test = _.curry(function(pattern, string){
return pattern.test(string);
});
exports.concat = _.curry(function(listA, listB){

@@ -36,1 +24,5 @@ return listA.concat(listB);

});
exports.match = _.curry(function(pattern, string){
return string.match(pattern);
});
{
"name": "css-revealer",
"version": "1.0.3",
"version": "1.0.4",
"description": "Reveal CSS selector usage within HTML templates.",

@@ -5,0 +5,0 @@ "bin": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc