Comparing version 0.3.1 to 0.3.2
13
main.js
@@ -102,3 +102,3 @@ "use strict"; | ||
output.write(` ${x.column}: ${type};\n`); | ||
output.write(` ${sanitize(x.column)}: ${type};\n`); | ||
@@ -184,2 +184,13 @@ if (!(columns[i + 1] && columns[i + 1].table === x.table)) { | ||
} | ||
} | ||
/** | ||
* Wraps the target property identifier into quotes in case it contains any | ||
* invalid characters. | ||
* | ||
* @see https://developer.mozilla.org/docs/Glossary/Identifier | ||
*/ | ||
function sanitize(name) { | ||
return /^[a-zA-Z$_][a-zA-Z$_0-9]*$/.test(name) ? name : JSON.stringify(name); | ||
} |
{ | ||
"name": "knex-types", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Generates TypeScript definitions (types) from a (PostgreSQL) database schema.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13817
205