Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
sql-formatter-plus
Advanced tools
A fork of SQL Formatter with some extra bug fixes and features.
Fixes:
New Features:
uppercase
config optionlinesBetweenQueries
config optionSQL Formatter is a JavaScript library for pretty-printing SQL queries. It started as a port of a PHP Library, but has since considerably diverged. It supports Standard SQL, Couchbase N1QL, IBM DB2 and Oracle PL/SQL dialects.
Get the latest version from NPM:
npm install sql-formatter
import sqlFormatter from 'sql-formatter-plus';
console.log(sqlFormatter.format('SELECT * FROM table1'));
This will output:
SELECT
*
FROM
table1
You can also pass in configuration options:
sqlFormatter.format('SELECT *', {
language: 'n1ql', // Defaults to "sql"
indent: ' ', // Defaults to two spaces,
uppercase: true, // Defaults to false
linesBetweenQueries: 2 // Defaults to 1
});
Currently just four SQL dialects are supported:
// Named placeholders
sqlFormatter.format("SELECT * FROM tbl WHERE foo = @foo", {
params: {foo: "'bar'"}
}));
// Indexed placeholders
sqlFormatter.format("SELECT * FROM tbl WHERE foo = ?", {
params: ["'bar'"]
}));
Both result in:
SELECT
*
FROM
tbl
WHERE
foo = 'bar'
If you don't use a module bundler, clone the repository, run npm install
and grab a file from /dist
directory to use inside a <script>
tag.
This makes SQL Formatter available as a global variable window.sqlFormatter
.
# run linter and tests
npm run check
...and you're ready to poke us with a pull request.
FAQs
Formats whitespace in a SQL query to make it more readable
The npm package sql-formatter-plus receives a total of 9,333 weekly downloads. As such, sql-formatter-plus popularity was classified as popular.
We found that sql-formatter-plus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.