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

krasota

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

krasota - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

tests/bootstrap-issues-3057.beautifiers

12

lib/krasota.js

@@ -20,5 +20,5 @@ var krasota = exports,

tree.splice(e.errorPos, 0, '\n--- Parse error ->');
UTIL.error(tree);
UTIL.debug(tree);
}
UTIL.error('error: ' + e);
UTIL.debug('error: ' + e);
throw e

@@ -52,11 +52,13 @@ }

var log = krasota.log = function(label, obj) {
if(process.env.KRASOTA_ENV != 'development') return;
if(arguments.length == 2) {
UTIL.error('---> ' + label + ':');
UTIL.debug('---> ' + label + ':');
inspect(obj);
UTIL.error('<--- ' + label + '\n');
} else UTIL.error(' \n' + label);
UTIL.debug('<--- ' + label + '\n');
} else UTIL.debug(' \n' + label);
};
var inspect = require('eyes').inspector({ maxLength: 99999, stream: process.stderr });

@@ -63,0 +65,0 @@ ['coa', 'parser', 'identity', 'serializer']

{
"name": "krasota",
"description": "Syntactic transformations of JavaScript code, with taking care of whitespaces and comments.",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "http://github.com/veged/krasota.js",

@@ -6,0 +6,0 @@ "author": "Sergey Berezhnoy <veged@ya.ru> (http://github.com/veged)",

@@ -36,2 +36,4 @@ ## What is this?

See below for available build-in beautifiers.
### API

@@ -61,9 +63,90 @@

There are some proof-of-concept beautifiers:
There are not many proof-of-concept beautifiers, but it's complex enough for using as samples for your own.
* [krasota/lib/beautifiers/always-semicolons](lib/beautifiers/always-semicolons.ometajs) -- force insert semicolons
* [krasota/lib/beautifiers/join-vars](lib/beautifiers/join-vars.ometajs) -- join multiply consecutive `var` statements into one `var` statement with multiply assigns
* [krasota/lib/beautifiers/split-vars](lib/beautifiers/split-vars.ometajs) -- split `var` statements with multiply assigns into multiply consecutive `var` statements
* [krasota/lib/beautifiers/trailing-whitespaces](lib/beautifiers/trailing-whitespaces.ometajs) -- remove trailing whitespaces
### [krasota/lib/beautifiers/always-semicolons](lib/beautifiers/always-semicolons.ometajs)
Force insert semicolons (you know [epic thread](https://github.com/twitter/bootstrap/issues/3057)).
Example:
<table>
<tr><th>before</th><th>after</th></tr>
<tr>
<td>
<pre>
clearMenus()
!isActive && $parent.toggleClass('open')
</pre>
</td>
<td>
<pre>
clearMenus();
!isActive && $parent.toggleClass('open');
</pre>
</td>
</tr>
</table>
### [krasota/lib/beautifiers/join-vars](lib/beautifiers/join-vars.ometajs)
Join multiply consecutive `var` statements into one `var` statement with multiply assigns.
Example:
<table>
<tr><th>before</th><th>after</th></tr>
<tr>
<td>
<pre>
var a = 1;
var b = 2;
var c = 3;
</pre>
</td>
<td>
<pre>
var a = 1,
b = 2,
c = 3;
</pre>
</td>
</tr>
</table>
### [krasota/lib/beautifiers/split-vars](lib/beautifiers/split-vars.ometajs)
Split `var` statements with multiply assigns into multiply consecutive `var` statements.
Example:
<table>
<tr><th>before</th><th>after</th></tr>
<tr>
<td>
<pre>
var a = 1,
b = 2,
c = 3;
</pre>
</td>
<td>
<pre>
var a = 1;
var b = 2;
var c = 3;
</pre>
</td>
</tr>
</table>
### [krasota/lib/beautifiers/trailing-whitespaces](lib/beautifiers/trailing-whitespaces.ometajs)
Remove trailing whitespaces (it's pretty simple without any examples).
## Tests

@@ -70,0 +153,0 @@

@@ -38,4 +38,2 @@ var UTIL = require('util'),

var inspect = require('eyes').inspector({ maxLength: 99999, stream: process.stderr });
function OkOrNot(ok, msg) {

@@ -42,0 +40,0 @@ var m = ok ? ['green', 'OK'] : ['red', 'NOT OK'];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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