Socket
Socket
Sign inDemoInstall

sql-formatter

Package Overview
Dependencies
Maintainers
2
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-formatter

Format whitespace in a SQL query to make it more readable


Version published
Weekly downloads
648K
increased by2.63%
Maintainers
2
Weekly downloads
 
Created

What is sql-formatter?

The sql-formatter npm package is a library for formatting SQL queries. It supports various SQL dialects and provides a clean and readable output for SQL statements.

What are sql-formatter's main functionalities?

Basic SQL Formatting

This feature allows you to format a basic SQL query into a more readable format.

const sqlFormatter = require('sql-formatter');
const formattedSQL = sqlFormatter.format('SELECT * FROM table WHERE column = value');
console.log(formattedSQL);

Dialect-Specific Formatting

This feature allows you to format SQL queries according to specific SQL dialects like MySQL, PostgreSQL, etc.

const sqlFormatter = require('sql-formatter');
const formattedSQL = sqlFormatter.format('SELECT * FROM table WHERE column = value', { language: 'mysql' });
console.log(formattedSQL);

Custom Indentation

This feature allows you to customize the indentation used in the formatted SQL output.

const sqlFormatter = require('sql-formatter');
const formattedSQL = sqlFormatter.format('SELECT * FROM table WHERE column = value', { indent: '    ' });
console.log(formattedSQL);

Other packages similar to sql-formatter

Keywords

FAQs

Package last updated on 11 Oct 2022

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