0.3.3 • Published 8 years ago
bem-json-to-html v0.3.3
bemjson-to-html
BEMJSON to HTML serializer
This is optimized part of jsot-bh for generation HTML from constructed BEMJSON.
API
Installing
npm install bem-json-to-html --save
new BEMJSON(options)
Creates serializer object.
Options:
jsAttrSchemeString - Ifjs, attribute with js params will be prefixed withreturn(default:js).jsAttrNameString - Specifies name of attribute, that will containjsParams(default:onclick).defaultTagString - Default tag name for block withouttagproperty (default:div).modificatorSeparatorString - Suffix to use for mods instead of default_one. (E.g.{modificatorSeparator: '--'}).addDefautTagAttributesBoolean - Add default tags attributes likesrc,href(defaukt:false).
BEMJSON.toHtml(bemjson)
Returns serialized HTML string.
Benchmark
trivial
4,133,717 op/s » bemjson-to-html
2,371,357 op/s » bh
simple
109,658 op/s » bemjson-to-html
78,604 op/s » bh
full
27,264 op/s » bemjson-to-html
23,367 op/s » bh
stringify
1,508,587 op/s » stringify (no escaping)
843,899 op/s » stringify (escaped with replace)
388,025 op/s » stringify (escaped)
312,156 op/s » bemjson-to-html
220,219 op/s » bhLicense
MIT (c) Vesvolod Strukchinsky, Pavlo Vozniuk