New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bem-json-to-html

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-json-to-html - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

bundle.js

24

index.js
var escape = require('./escape.js');
var DEFAULT_MOD_SEPARATOR = '_';
var _jsAttrName = 'onclick';

@@ -12,3 +14,4 @@ var _defaultTag = 'div';

options.defaultTag = options.defaultTag || _defaultTag;
options.modificatorSeparator = options.modificatorSeparator || '_';
options.modificatorSeparator = options.modificatorSeparator || DEFAULT_MOD_SEPARATOR;
options.addDefautTagAttributes = options.addDefautTagAttributes || false;

@@ -25,4 +28,4 @@ this._options = options;

var mods = bemjson.elem ? bemjson.elemMods : bemjson.mods;
var modSep = this._options.modificatorSeparator;
var modSep = this._options && this._options.modificatorSeparator ? this._options.modificatorSeparator : DEFAULT_MOD_SEPARATOR;
if (mods) {

@@ -135,2 +138,17 @@ for (var i in mods) {

var tag = bemjson.tag;
if (this._options.addDefautTagAttributes) {
if (tag === 'img') {
res += ' src="#" alt="" ';
}
if (tag === 'a') {
res += ' href="#" ';
}
if (tag === 'source') {
res += ' src="#" ';
}
}
if (tag === 'area' ||

@@ -137,0 +155,0 @@ tag === 'base' ||

6

package.json
{
"name": "bem-json-to-html",
"version": "0.3.2",
"version": "0.3.3",
"description": "BEMJSON to HTML serializer",
"main": "index.js",
"scripts": {
"test": "mocha -R spec"
"test": "mocha -R spec",
"bundle": "browserify index.js --s BEMJSON > bundle.js"
},

@@ -27,2 +28,3 @@ "repository": {

"bh": "^3.2.2",
"browserify": "^14.5.0",
"enb": "^0.13.4",

@@ -29,0 +31,0 @@ "matcha": "^0.6.0",

@@ -6,2 +6,4 @@ # bemjson-to-html

[DEMO](https://pvoznyuk.github.io/bemjson-to-html/)
## API

@@ -19,6 +21,7 @@

* `jsAttrScheme` _Boolean_ - If `js`, attribute with js params will be prefixed with `return ` (default: `js`).
* `jsAttrScheme` _String_ - If `js`, attribute with js params will be prefixed with `return ` (default: `js`).
* `jsAttrName` _String_ - Specifies name of attribute, that will contain `jsParams` (default: `onclick`).
* `defaultTag` _String_ - Default tag name for block without `tag` property (default: `div`).
* `modificatorSeparator` _String_ - Suffix to use for mods instead of default `_` one. (E.g. `{modificatorSeparator: '--'}`).
* `addDefautTagAttributes` _Boolean_ - Add default tags attributes like `src`, `href` (defaukt: `false`).

@@ -25,0 +28,0 @@ ### BEMJSON.toHtml(bemjson)

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