Skip to content

Commit 80bb466

Browse files
committed
Added default export
Added default export and deprecation for named export.
1 parent 7cae738 commit 80bb466

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ function highlight (sqlString, options) {
9292
return highlighted
9393
}
9494

95-
module.exports = {
96-
highlight
95+
module.exports = highlight
96+
module.exports.highlight = (...args) => {
97+
console.warn('[sql-highlight] The use of the named exports will be deprecated in a future version of sql-highlight. See https://github.com/scriptcoded/sql-highlight/issues/5 for more information.')
98+
return highlight(...args)
9799
}

test/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
* that. It's just to see that it's working in the console.
44
*/
55

6-
const { highlight } = require('../index')
6+
const { highlight: highlightNamed } = require('../index')
7+
const highlight = require('../index')
78

89
console.log(highlight("SELECT COUNT(id), COUNT(id), `id`, `username` FROM `users` WHERE `email` = '[email protected]' AND `something` = 'oke' AND 1=1"))
910
console.log(highlight('SELECT "users".* FROM "users"'))
1011
console.log(highlight(`select "users".* from "users" where ("username" = 'test' or "email" = 'test') and "is_admin" = true and "is_banned" = false limit 1`))
12+
13+
console.log(highlightNamed('SELECT COUNT(bar) FROM foo'))

0 commit comments

Comments
 (0)