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

sql-formatter

Package Overview
Dependencies
Maintainers
2
Versions
146
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

  • 12.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
647K
decreased by-0.27%
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 09 Jun 2023

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