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

gonzales-pe

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gonzales-pe - npm Package Compare versions

Comparing version 3.0.0-29 to 3.0.0-30

lib/empty.js

1

lib/node-types.js

@@ -25,2 +25,3 @@ module.exports = {

EscapedStringType: 'escapedString',
ExtendType: 'extend',
ExpressionType: 'expression',

@@ -27,0 +28,0 @@ FunctionType: 'function',

@@ -43,2 +43,25 @@ /**

/**
* @param {String} type Node type
* @param {Function} callback Function to call for every found node
*/
eachFor: function(type, callback) {
if (!Array.isArray(this.content)) return;
if (typeof type !== 'string') callback = type, type = null;
var l = this.content.length;
var i = l;
var breakLoop;
for (var i = l; i--;) {
if (breakLoop === null) break;
if (!type || this.content[i] && this.content[i].type === type)
breakLoop = callback(this.content[i], i, this);
}
if (breakLoop === null) return null;
},
/**
* @param {String} type

@@ -69,7 +92,12 @@ * @return {Node} First child node

var l = this.content.length;
var breakLoop;
for (; i < l; i++) {
if (breakLoop === null) break;
if (!type || this.content[i] && this.content[i].type === type)
callback(this.content[i], i);
breakLoop = callback(this.content[i], i, this);
}
if (breakLoop === null) return null;
},

@@ -120,11 +148,24 @@

*/
map: function(callback) {
callback(this);
traverse: function(type, callback, i, parent) {
if (typeof type === 'function') callback = type, type = null;
if (!type || this.type === type) callback(this, i, parent);
if (!Array.isArray(this.content)) return;
this.content.forEach(function(node) {
if (node instanceof Node)
node.map(callback);
});
var i = 0;
var l = this.content.length;
var breakLoop;
for (; i < l; i++) {
breakLoop = this.content[i].traverse(type, callback, i, this);
if (!breakLoop === null) break;
// If some nodes were removed or added:
var x = this.content.length - l;
l += x;
i += x;
}
if (breakLoop === null) return null;
},

@@ -131,0 +172,0 @@

4

lib/parse.js

@@ -17,4 +17,6 @@ var fs = require('fs');

function parse(css, options) {
if (!css || typeof css !== 'string')
if (typeof css !== 'string')
throw new Error('Please, pass a string to parse');
else if (!css)
return require('./empty')();

@@ -21,0 +23,0 @@ var syntax = options && options.syntax || Defaults.SYNTAX;

{
"name": "gonzales-pe",
"description": "Gonzales Preprocessor Edition (fast CSS parser)",
"version": "3.0.0-29",
"version": "3.0.0-30",
"homepage": "http://github.com/tonyganch/gonzales-pe",

@@ -6,0 +6,0 @@ "bugs": "http://github.com/tonyganch/gonzales-pe/issues",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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