Socket
Socket
Sign inDemoInstall

shortcode-tree

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shortcode-tree - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

5

dist/shortcode-tree.js

@@ -26,3 +26,2 @@ 'use strict';

/**

@@ -71,2 +70,6 @@ * Traverses a tree node: extracts short codes from the node text, and traverses its child nodes.

}
},
extractTextContent(input) {
}

@@ -73,0 +76,0 @@ };

4

package.json
{
"name": "shortcode-tree",
"version": "1.3.1",
"version": "1.4.0",
"description": "Parser library for reading short codes (BB codes) into a tree structure",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"build": "babel src --presets babel-preset-es2015 --out-dir dist",
"prepublish": "npm run build"
"prepublishOnly": "npm run build"
},

@@ -12,0 +12,0 @@ "author": "Roy de Jong <roy@softwarepunt.nl>",

@@ -121,2 +121,38 @@ let ShortcodeTree = require('../src').ShortcodeTree;

});
});
describe('ShortcodeTree.extractTextContent()', function () {
it ('leaves plain text alone', function () {
let testInput = `blah blah`;
let expectedOutput = testInput;
let actualOutput = ShortcodeTree.extractTextContent(testInput);
expect(actualOutput).to.equal(expectedOutput);
});
it ('strips code text from a simple shortcode', function () {
let testInputInner = 'blah <b>blah</b> blah';
let testInput = `[b]${testInputInner}[/b]`;
let expectedOutput = testInputInner;
let actualOutput = ShortcodeTree.extractTextContent(testInput);
expect(actualOutput).to.equal(expectedOutput);
});
it ('strips code text from deep nested shortcodes', function () {
let testInput = `root [row][column]deep[/column][/row]`;
let expectedOutput = "root deep";
let actualOutput = ShortcodeTree.extractTextContent(testInput);
expect(actualOutput).to.equal(expectedOutput);
});
it ('adds automatic spaces between text from different nesting levels', function () {
let testInput = `[page][row][col]<h1>some text</h1>[img/][sub]bla[/sub]w[/col]a[/row]w[/page]`;
let expectedOutput = "<h1>some text</h1> bla w a w";
let actualOutput = ShortcodeTree.extractTextContent(testInput);
expect(actualOutput).to.equal(expectedOutput);
});
});

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