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

@bbob/parser

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bbob/parser - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

17

CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

<a name="1.2.0"></a>
# [1.2.0](https://github.com/JiLiZART/bbob/compare/@bbob/parser@1.1.0...@bbob/parser@1.2.0) (2018-08-09)
### Bug Fixes
* **parser:** remove bad code ([4d9dc34](https://github.com/JiLiZART/bbob/commit/4d9dc34))
### Features
* **parser:** add support for custom tokenizer ([ce03b2f](https://github.com/JiLiZART/bbob/commit/ce03b2f))
* **parser:** inconsistent tag detection test ([2eb83c1](https://github.com/JiLiZART/bbob/commit/2eb83c1))
<a name="1.1.0"></a>

@@ -8,0 +25,0 @@ # [1.1.0](https://github.com/JiLiZART/bbob/compare/@bbob/parser@1.0.10...@bbob/parser@1.1.0) (2018-07-13)

14

lib/parse.js
const Tokenizer = require('./Tokenizer');
const TagNode = require('./TagNode');
const TagNode = require('@bbob/plugin-helper/lib/TagNode');

@@ -31,10 +31,2 @@ /**

/**
*
* @param tag
* @param attrs
* @param content
*/
const newTagNode = (tag, attrs = {}, content = []) => new TagNode(tag, attrs, content);
const createTokenizer = (input, onToken) => new Tokenizer(input, { onToken });

@@ -60,3 +52,3 @@

*/
const createTagNode = token => tagNodes.push(newTagNode(token.getValue()));
const createTagNode = token => tagNodes.push(TagNode.create(token.getValue()));
/**

@@ -228,3 +220,3 @@ * @private

options = opts;
tokenizer = createTokenizer(input, parseToken);
tokenizer = (opts.createTokenizer ? opts.createTokenizer : createTokenizer)(input, parseToken);

@@ -231,0 +223,0 @@ nodes = [];

@@ -6,3 +6,3 @@ const {

SLASH,
} = require('./char');
} = require('@bbob/plugin-helper/lib/char');

@@ -9,0 +9,0 @@ // type, value, line, row,

@@ -8,3 +8,3 @@ const {

BACKSLASH,
} = require('./char');
} = require('@bbob/plugin-helper/lib/char');
const Token = require('./Token');

@@ -11,0 +11,0 @@

{
"name": "@bbob/parser",
"version": "1.1.0",
"version": "1.2.0",
"description": "Fast, flexible, and lean implementation of BBcode parser",

@@ -22,2 +22,5 @@ "homepage": "https://github.com/JiLiZART/bbob",

"main": "lib/index.js",
"dependencies": {
"@bbob/plugin-helper": "^1.1.0"
},
"repository": {

@@ -32,6 +35,12 @@ "type": "git",

"cover": "../../node_modules/.bin/jest --coverage",
"lint": "../../node_modules/.bin/eslint ."
"lint": "../../node_modules/.bin/eslint .",
"size": "../../node_modules/.bin/size-limit"
},
"author": "Nikolay Kostyurin <jilizart@gmail.com>",
"license": "MIT",
"size-limit": [
{
"path": "lib/index.js"
}
],
"publishConfig": {

@@ -38,0 +47,0 @@ "registry": "https://registry.npmjs.org/"

# @bbob/parser
[![install size](https://packagephobia.now.sh/badge?p=@bbob/parser)](https://packagephobia.now.sh/result?p=@bbob/parser)
[![install size](https://packagephobia.now.sh/badge?p=@bbob/parser)](https://packagephobia.now.sh/result?p=@bbob/parser) [![Known Vulnerabilities](https://snyk.io/test/github/JiLiZART/bbob/badge.svg?targetFile=packages%2Fbbob-parser%2Fpackage.json)](https://snyk.io/test/github/JiLiZART/bbob?targetFile=packages%2Fbbob-parser%2Fpackage.json)
Parses BBCode and returns AST Tree looks like
> Parses BBCode and returns array AST tree
Valid for use with [posthtml-render](https://github.com/posthtml/posthtml-render)
`[url=]hello world![/url]`
to
## Usage
```js
import parse from '@bbob/parser'
const options = {
onlyAllowTags: ['url', 'h'],
onError: (err) => console.warn(err.message, err.lineNumber, err.columnNumber)
}
const ast = parse('[url=https://github.com]hello world![/url]', options)
```
## Results
```json

@@ -15,3 +27,3 @@ [

"attrs": {
"url": "https://github.com/JiLiZART/bbob/tree/master/packages/bbob-parser"
"url": "https://github.com"
},

@@ -18,0 +30,0 @@ "content": ["hello", " ", "world!"]

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