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

mdast-squeeze-paragraphs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-squeeze-paragraphs - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

18

index.js
'use strict';
var remove = require('unist-util-remove');
module.exports = function (ast) {
ast.children = ast.children.filter(function (node) {
return node.type != 'paragraph' || node.children.some(function (node) {
return node.type != 'text' || !/^\s*$/.test(node.value);
});
return remove(ast, { cascade: false }, isEmptyParagraph);
};
// Whether paragraph is empty or composed only of whitespace.
function isEmptyParagraph (node) {
return node.type == 'paragraph' && node.children.every(function (node) {
return node.type == 'text' && /^\s*$/.test(node.value);
});
return ast;
};
}
{
"name": "mdast-squeeze-paragraphs",
"version": "3.0.0",
"version": "3.0.1",
"description": "Remove empty paragraphs from mdast tree",

@@ -31,6 +31,9 @@ "author": "Eugene Sharygin <eush77@gmail.com>",

],
"dependencies": {},
"dependencies": {
"unist-util-remove": "^0.2.0"
},
"devDependencies": {
"tape": "^4.0.0"
"tape": "^4.0.0",
"unist-builder": "^1.0.0"
}
}
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