Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-beautify

Package Overview
Dependencies
Maintainers
2
Versions
128
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.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4M
decreased by-0.82%
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

FAQs

Package last updated on 06 Aug 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

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