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

@bbob/core

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bbob/core - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

dist/index.js

49

lib/index.js

@@ -1,37 +0,39 @@

const parser = require('@bbob/parser');
const render = require('@bbob/html');
'use strict';
const { iterate, match } = require('./utils');
exports.__esModule = true;
exports.default = bbob;
var _parser = require('@bbob/parser');
var _utils = require('./utils');
function walk(cb) {
return iterate(this, cb);
return (0, _utils.iterate)(this, cb);
}
module.exports = function bbob(plugs) {
const plugins = typeof plugs === 'function' ? [plugs] : plugs || [];
function bbob(plugs) {
var plugins = typeof plugs === 'function' ? [plugs] : plugs || [];
let options = {
skipParse: false,
var options = {
skipParse: false
};
return {
process(input, opts) {
process: function process(input, opts) {
options = opts || {};
const parseFn = options.parser || parser;
const renderFn = options.render || render;
var parseFn = options.parser || _parser.parse;
var renderFn = options.render;
let tree = options.skipParse
? input || []
: parseFn(input, options);
var tree = options.skipParse ? input || [] : parseFn(input, options);
tree.walk = walk;
tree.match = match;
tree.match = _utils.match;
plugins.forEach((plugin) => {
plugins.forEach(function (plugin) {
tree = plugin(tree, {
parse: parseFn,
render: renderFn,
iterate,
match,
iterate: _utils.iterate,
match: _utils.match
}) || tree;

@@ -42,9 +44,12 @@ });

get html() {
if (typeof renderFn !== 'function') {
throw new Error('"render" function not defined, please pass to "process(input, { render })"');
}
return renderFn(tree, tree.options);
},
tree,
messages: tree.messages,
tree: tree,
messages: tree.messages
};
},
}
};
};
}

@@ -0,10 +1,17 @@

'use strict';
exports.__esModule = true;
/* eslint-disable no-plusplus */
const isObj = value => (typeof value === 'object');
const isBool = value => (typeof value === 'boolean');
var isObj = function isObj(value) {
return typeof value === 'object';
};
var isBool = function isBool(value) {
return typeof value === 'boolean';
};
function iterate(t, cb) {
const tree = t;
var tree = t;
if (Array.isArray(tree)) {
for (let idx = 0; idx < tree.length; idx++) {
for (var idx = 0; idx < tree.length; idx++) {
tree[idx] = iterate(cb(tree[idx]), cb);

@@ -29,8 +36,12 @@ }

if (Array.isArray(expected)) {
return expected.every(exp => [].some.call(actual, act => same(exp, act)));
return expected.every(function (exp) {
return [].some.call(actual, function (act) {
return same(exp, act);
});
});
}
return Object.keys(expected).every((key) => {
const ao = actual[key];
const eo = expected[key];
return Object.keys(expected).every(function (key) {
var ao = actual[key];
var eo = expected[key];

@@ -50,18 +61,16 @@ if (isObj(eo) && eo !== null && ao !== null) {

function match(expression, cb) {
return Array.isArray(expression)
? iterate(this, (node) => {
for (let idx = 0; idx < expression.length; idx++) {
if (same(expression[idx], node)) {
return cb(node);
}
return Array.isArray(expression) ? iterate(this, function (node) {
for (var idx = 0; idx < expression.length; idx++) {
if (same(expression[idx], node)) {
return cb(node);
}
}
return node;
})
: iterate(this, node => (same(expression, node) ? cb(node) : node));
return node;
}) : iterate(this, function (node) {
return same(expression, node) ? cb(node) : node;
});
}
module.exports = {
iterate,
match,
};
exports.iterate = iterate;
exports.match = match;
{
"name": "@bbob/core",
"version": "1.1.0",
"description": "BBob is a tool to transform BBCode markup useing presets",
"main": "lib/index.js",
"directories": {
"lib": "lib"
},
"dependencies": {
"@bbob/html": "^1.1.0",
"@bbob/parser": "^1.2.0"
},
"peerDependencies": {
"@bbob/preset-html5": "^1.x"
},
"repository": {
"type": "git",
"url": "git+https://github.com/JiLiZART/bbob.git"
},
"version": "2.0.0",
"description": "Fast, flexible, and lean implementation of BBcode parser with plugins",
"keywords": [
"bbcode",
"parser",
"fast",
"bbcode parser",
"bbcodeparser",
"bbob",
"serializer",
"bbcode serializer",
"bbcode serializer",
"bbcodeserializer",
"parse",
"serialize",
"html",
"transform"
],
"dependencies": {
"@bbob/parser": "^2.0.0"
},
"devDependencies": {
"@bbob/html": "^2.0.0"
},
"peerDependencies": {
"@bbob/html": "^1.x",
"@bbob/preset-html5": "^1.x",
"@bbob/preset-react": "^1.x",
"@bbob/react": "^1.x"
},
"main": "lib/index.js",
"module": "es/index.js",
"jsnext:main": "es/index.js",
"browser": "dist/index.js",
"browserName": "BbobCore",
"homepage": "https://github.com/JiLiZART/bbob",
"author": "Nikolay Kostyurin <jilizart@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/JiLiZART/bbob/issues"
},
"homepage": "https://github.com/JiLiZART/bbob#readme",
"repository": {
"type": "git",
"url": "git://github.com/JiLiZART/bbob.git"
},
"scripts": {
"build:commonjs": "../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../node_modules/.bin/babel src --out-dir lib",
"build:es": "../../node_modules/.bin/cross-env BABEL_ENV=es ../../node_modules/.bin/babel src --out-dir es",
"build:umd": "../../node_modules/.bin/cross-env BABEL_ENV=rollup NODE_ENV=development ../../node_modules/.bin/rollup --config ../../rollup.config.js",
"build": "npm run build:commonjs && npm run build:es && npm run build:umd",
"test": "../../node_modules/.bin/jest --",
"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": {
"registry": "https://registry.npmjs.org/"
}
},
"files": [
"dist",
"lib",
"src",
"es"
]
}

@@ -7,8 +7,9 @@ # @bbob/core

const bbob = require('@bbob/core');
const render = require('@bbob/html');
const presetHTML5 = require('@bbob/preset-html5');
const code = `[i]Text[/i]`;
const html = bbob([presetHTML5()]).process(code).html;
const html = bbob([presetHTML5()]).process(code, { render }).html;
console.log(html); // <span style="font-style: italic;">Text</span>
```
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