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

bemhtml-syntax

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bemhtml-syntax - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

test/tt.bemhtml

2

package.json
{
"name": "bemhtml-syntax",
"version": "0.0.2",
"version": "0.0.3",
"description": "BEMHTML syntax converter",

@@ -5,0 +5,0 @@ "main": "lib/syntax.js",

@@ -9,22 +9,30 @@ var syntax = require(".."),

bemxjst = require("bem-xjst"),
compat = require("bemhtml-compat");
compat = require("bemhtml-compat"),
options = {};
// var source = fs.readFileSync('./tt.bemhtml', {encoding: 'utf8'});
var source = "function test() { for(var i = 0;i < 2;i++) { }; return [];}";
// var source = "function test(){for(;;){};return []}";
var esprima = require("esprima"),
esgen = require("escodegen").generate;
var code = fs.readFileSync('./basic/info7.bemhtml.js', {encoding: 'utf8'});
// Парсим
var ast = syntax.parse(source);
pp(ast, {prompt: "ast"});
// Делаем всякую магию с деревом
var newAst = syntax.translate(ast);
pp(newAst, {prompt: "newAst"});
// Сериализуем в JavaScript
var jsCode1 = syntax.generate(newAst, options);
pp(jsCode1, {prompt: "jsCode1"});
var esprima = require("esprima"),
esgen = require("escodegen").generate,
uglify = require("uglify-js");
// Все сразу одним махом, наверное, только это вам и нужно
var jsCode2 = syntax.compile(source, options);
var exhibit1 = '"\0 \x00 \u0000 0 \x30 \u0030"',
ast1 = esprima.parse(exhibit1),
exhibit2 = "'привет'",
ast2 = esprima.parse(exhibit2);
var east = esprima.parse(source);
pp(east, {prompt: "east"});
esgen(ast1);
uglify.AST_Node.from_mozilla_ast(ast1).print_to_string();
pp(esgen(east), {prompt: "esgen(east)"});
esgen(ast2);
uglify.AST_Node.from_mozilla_ast(ast2).print_to_string();

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