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

js-beautify

Package Overview
Dependencies
Maintainers
2
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-beautify

beautifier.io for node

1.10.1-rc2
Source
npm
Version published
Weekly downloads
5.1M
2.36%
Maintainers
2
Weekly downloads
 
Created

What is js-beautify?

The js-beautify npm package is a utility to format and beautify JavaScript, CSS, and HTML code. It can be used to make code more readable and consistent by automatically formatting it according to specified options.

What are js-beautify's main functionalities?

Beautify JavaScript

This feature formats JavaScript code to make it more readable. The 'indent_size' option specifies the number of spaces to use for indentation.

const beautify = require('js-beautify').js;

const uglyJs = 'function foo(){return 42;}';
const beautifulJs = beautify(uglyJs, { indent_size: 2 });

console.log(beautifulJs);

Beautify CSS

This feature formats CSS code to improve its readability. The 'indent_size' option is used here as well to set the indentation level.

const beautify = require('js-beautify').css;

const uglyCss = 'body{background-color:#000;}';
const beautifulCss = beautify(uglyCss, { indent_size: 2 });

console.log(beautifulCss);

Beautify HTML

This feature formats HTML code, enhancing its structure and readability. The 'indent_size' option controls the indentation.

const beautify = require('js-beautify').html;

const uglyHtml = '<div><p>hello world</p></div>';
const beautifulHtml = beautify(uglyHtml, { indent_size: 2 });

console.log(beautifulHtml);

Other packages similar to js-beautify

Keywords

beautify

FAQs

Package last updated on 17 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts