npm.io
0.0.1 • Published 8 years ago

@ftchinese/sql-trim

Licence
MIT
Version
0.0.1
Deps
0
Size
3 kB
Vulns
0
Weekly
0

Tag function to trim whitespaces and turn template string into one line. This is mainly used to write fomatted sql statement.

Example

const sql = require('@ftchinese/sql-trim');

const stmt = sql`
SELECT name AS name,
    email AS email,
    mobile_phone AS mobilePhone
FROM user
WHERE id = :id
LIMIT 1`;

const [rows, ] = conn.execute(stmt, {1});

stmt will be one line of string: SELECT name AS name, email AS email, mobile_phone AS mobilePhone FROM user WHERE id = :id LIMIT 1.