sql-formatter
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -5,2 +5,6 @@ "use strict"; | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _lodash = require("lodash"); | ||
@@ -24,4 +28,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var Formatter = function () { | ||
@@ -34,3 +36,3 @@ /** | ||
function Formatter(cfg, tokenizer) { | ||
_classCallCheck(this, Formatter); | ||
(0, _classCallCheck3["default"])(this, Formatter); | ||
@@ -37,0 +39,0 @@ this.cfg = cfg || {}; |
@@ -5,2 +5,6 @@ "use strict"; | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _lodash = require("lodash"); | ||
@@ -12,4 +16,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var INDENT_TYPE_TOP_LEVEL = "top-level"; | ||
@@ -32,3 +34,3 @@ var INDENT_TYPE_BLOCK_LEVEL = "block-level"; | ||
function Indentation(indent) { | ||
_classCallCheck(this, Indentation); | ||
(0, _classCallCheck3["default"])(this, Indentation); | ||
@@ -46,3 +48,3 @@ this.indent = indent || " "; | ||
Indentation.prototype.getIndent = function getIndent() { | ||
return this.indent.repeat(this.indentTypes.length); | ||
return _lodash2["default"].repeat(this.indent, this.indentTypes.length); | ||
}; | ||
@@ -49,0 +51,0 @@ |
@@ -5,2 +5,6 @@ "use strict"; | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _tokenTypes = require("./tokenTypes"); | ||
@@ -12,4 +16,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var INLINE_MAX_LENGTH = 50; | ||
@@ -27,3 +29,3 @@ | ||
function InlineBlock() { | ||
_classCallCheck(this, InlineBlock); | ||
(0, _classCallCheck3["default"])(this, InlineBlock); | ||
@@ -30,0 +32,0 @@ this.level = 0; |
@@ -5,2 +5,6 @@ "use strict"; | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _lodash = require("lodash"); | ||
@@ -16,4 +20,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var Tokenizer = function () { | ||
@@ -31,3 +33,3 @@ /** | ||
function Tokenizer(cfg) { | ||
_classCallCheck(this, Tokenizer); | ||
(0, _classCallCheck3["default"])(this, Tokenizer); | ||
@@ -34,0 +36,0 @@ this.WORD_REGEX = /^(\w+)/; |
@@ -5,2 +5,6 @@ "use strict"; | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _Formatter = require("../core/Formatter"); | ||
@@ -16,4 +20,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var reservedWords = ["ALL", "ALTER", "ANALYZE", "AND", "ANY", "ARRAY", "AS", "ASC", "BEGIN", "BETWEEN", "BINARY", "BOOLEAN", "BREAK", "BUCKET", "BUILD", "BY", "CALL", "CASE", "CAST", "CLUSTER", "COLLATE", "COLLECTION", "COMMIT", "CONNECT", "CONTINUE", "CORRELATE", "COVER", "CREATE", "DATABASE", "DATASET", "DATASTORE", "DECLARE", "DECREMENT", "DELETE", "DERIVED", "DESC", "DESCRIBE", "DISTINCT", "DO", "DROP", "EACH", "ELEMENT", "ELSE", "END", "EVERY", "EXCEPT", "EXCLUDE", "EXECUTE", "EXISTS", "EXPLAIN", "FALSE", "FETCH", "FIRST", "FLATTEN", "FOR", "FORCE", "FROM", "FUNCTION", "GRANT", "GROUP", "GSI", "HAVING", "IF", "IGNORE", "ILIKE", "IN", "INCLUDE", "INCREMENT", "INDEX", "INFER", "INLINE", "INNER", "INSERT", "INTERSECT", "INTO", "IS", "JOIN", "KEY", "KEYS", "KEYSPACE", "KNOWN", "LAST", "LEFT", "LET", "LETTING", "LIKE", "LIMIT", "LSM", "MAP", "MAPPING", "MATCHED", "MATERIALIZED", "MERGE", "MINUS", "MISSING", "NAMESPACE", "NEST", "NOT", "NULL", "NUMBER", "OBJECT", "OFFSET", "ON", "OPTION", "OR", "ORDER", "OUTER", "OVER", "PARSE", "PARTITION", "PASSWORD", "PATH", "POOL", "PREPARE", "PRIMARY", "PRIVATE", "PRIVILEGE", "PROCEDURE", "PUBLIC", "RAW", "REALM", "REDUCE", "RENAME", "RETURN", "RETURNING", "REVOKE", "RIGHT", "ROLE", "ROLLBACK", "SATISFIES", "SCHEMA", "SELECT", "SELF", "SEMI", "SET", "SHOW", "SOME", "START", "STATISTICS", "STRING", "SYSTEM", "THEN", "TO", "TRANSACTION", "TRIGGER", "TRUE", "TRUNCATE", "UNDER", "UNION", "UNIQUE", "UNKNOWN", "UNNEST", "UNSET", "UPDATE", "UPSERT", "USE", "USER", "USING", "VALIDATE", "VALUE", "VALUED", "VALUES", "VIA", "VIEW", "WHEN", "WHERE", "WHILE", "WITH", "WITHIN", "WORK", "XOR"]; | ||
@@ -32,3 +34,3 @@ | ||
function N1qlFormatter(cfg) { | ||
_classCallCheck(this, N1qlFormatter); | ||
(0, _classCallCheck3["default"])(this, N1qlFormatter); | ||
@@ -35,0 +37,0 @@ this.cfg = cfg; |
@@ -5,2 +5,6 @@ "use strict"; | ||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _Formatter = require("../core/Formatter"); | ||
@@ -16,4 +20,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var reservedWords = ["ACCESSIBLE", "ACTION", "AGAINST", "AGGREGATE", "ALGORITHM", "ALL", "ALTER", "ANALYSE", "ANALYZE", "AS", "ASC", "AUTOCOMMIT", "AUTO_INCREMENT", "BACKUP", "BEGIN", "BETWEEN", "BINLOG", "BOTH", "CASCADE", "CASE", "CHANGE", "CHANGED", "CHARACTER SET", "CHARSET", "CHECK", "CHECKSUM", "COLLATE", "COLLATION", "COLUMN", "COLUMNS", "COMMENT", "COMMIT", "COMMITTED", "COMPRESSED", "CONCURRENT", "DROP", "CONSTRAINT", "CONTAINS", "CONVERT", "CREATE", "CROSS", "CURRENT_TIMESTAMP", "DATABASE", "DATABASES", "DAY", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "DEFAULT", "DEFINER", "DELAYED", "DELETE", "DESC", "DESCRIBE", "DETERMINISTIC", "DISTINCT", "DISTINCTROW", "DIV", "DO", "DUMPFILE", "DUPLICATE", "DYNAMIC", "ELSE", "ENCLOSED", "END", "ENGINE", "ENGINE_TYPE", "ENGINES", "ESCAPE", "ESCAPED", "EVENTS", "EXEC", "EXECUTE", "EXISTS", "EXPLAIN", "EXTENDED", "FAST", "FIELDS", "FILE", "FIRST", "FIXED", "FLUSH", "FOR", "FORCE", "FOREIGN", "FULL", "FULLTEXT", "FUNCTION", "GLOBAL", "GRANT", "GRANTS", "GROUP_CONCAT", "HEAP", "HIGH_PRIORITY", "HOSTS", "HOUR", "HOUR_MINUTE", "HOUR_SECOND", "IDENTIFIED", "IF", "IFNULL", "IGNORE", "IN", "INDEX", "INDEXES", "INFILE", "INSERT", "INSERT_ID", "INSERT_METHOD", "INTERVAL", "INTO", "INVOKER", "IS", "ISOLATION", "KEY", "KEYS", "KILL", "LAST_INSERT_ID", "LEADING", "LEVEL", "LIKE", "LINEAR", "LINES", "LOAD", "LOCAL", "LOCK", "LOCKS", "LOGS", "LOW_PRIORITY", "MARIA", "MASTER", "MASTER_CONNECT_RETRY", "MASTER_HOST", "MASTER_LOG_FILE", "MATCH", "MAX_CONNECTIONS_PER_HOUR", "MAX_QUERIES_PER_HOUR", "MAX_ROWS", "MAX_UPDATES_PER_HOUR", "MAX_USER_CONNECTIONS", "MEDIUM", "MERGE", "MINUTE", "MINUTE_SECOND", "MIN_ROWS", "MODE", "MODIFY", "MONTH", "MRG_MYISAM", "MYISAM", "NAMES", "NATURAL", "NOT", "NOW()", "NULL", "OFFSET", "ON", "OPEN", "OPTIMIZE", "OPTION", "OPTIONALLY", "ON UPDATE", "ON DELETE", "OUTFILE", "PACK_KEYS", "PAGE", "PARTIAL", "PARTITION", "PARTITIONS", "PASSWORD", "PRIMARY", "PRIVILEGES", "PROCEDURE", "PROCESS", "PROCESSLIST", "PURGE", "QUICK", "RANGE", "RAID0", "RAID_CHUNKS", "RAID_CHUNKSIZE", "RAID_TYPE", "READ", "READ_ONLY", "READ_WRITE", "REFERENCES", "REGEXP", "RELOAD", "RENAME", "REPAIR", "REPEATABLE", "REPLACE", "REPLICATION", "RESET", "RESTORE", "RESTRICT", "RETURN", "RETURNS", "REVOKE", "RLIKE", "ROLLBACK", "ROW", "ROWS", "ROW_FORMAT", "SECOND", "SECURITY", "SEPARATOR", "SERIALIZABLE", "SESSION", "SHARE", "SHOW", "SHUTDOWN", "SLAVE", "SONAME", "SOUNDS", "SQL", "SQL_AUTO_IS_NULL", "SQL_BIG_RESULT", "SQL_BIG_SELECTS", "SQL_BIG_TABLES", "SQL_BUFFER_RESULT", "SQL_CALC_FOUND_ROWS", "SQL_LOG_BIN", "SQL_LOG_OFF", "SQL_LOG_UPDATE", "SQL_LOW_PRIORITY_UPDATES", "SQL_MAX_JOIN_SIZE", "SQL_QUOTE_SHOW_CREATE", "SQL_SAFE_UPDATES", "SQL_SELECT_LIMIT", "SQL_SLAVE_SKIP_COUNTER", "SQL_SMALL_RESULT", "SQL_WARNINGS", "SQL_CACHE", "SQL_NO_CACHE", "START", "STARTING", "STATUS", "STOP", "STORAGE", "STRAIGHT_JOIN", "STRING", "STRIPED", "SUPER", "TABLE", "TABLES", "TEMPORARY", "TERMINATED", "THEN", "TO", "TRAILING", "TRANSACTIONAL", "TRUE", "TRUNCATE", "TYPE", "TYPES", "UNCOMMITTED", "UNIQUE", "UNLOCK", "UNSIGNED", "USAGE", "USE", "USING", "VARIABLES", "VIEW", "WHEN", "WITH", "WORK", "WRITE", "YEAR_MONTH"]; | ||
@@ -32,3 +34,3 @@ | ||
function StandardSqlFormatter(cfg) { | ||
_classCallCheck(this, StandardSqlFormatter); | ||
(0, _classCallCheck3["default"])(this, StandardSqlFormatter); | ||
@@ -35,0 +37,0 @@ this.cfg = cfg; |
@@ -5,4 +5,2 @@ "use strict"; | ||
require("babel-polyfill"); | ||
var _N1qlFormatter = require("./languages/N1qlFormatter"); | ||
@@ -9,0 +7,0 @@ |
{ | ||
"name": "sql-formatter", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Formats whitespaces in a SQL query to make it more readable", | ||
@@ -32,3 +32,3 @@ "main": "lib/sqlFormatter.js", | ||
"build:umd:min": "cross-env NODE_ENV=production webpack src/sqlFormatter.js dist/sql-formatter.min.js", | ||
"prepublish": "npm run clean && npm run check && npm run build && check-es3-syntax lib/ dist/ --kill --print" | ||
"prepublish": "npm run clean && npm run check && npm run build" | ||
}, | ||
@@ -40,3 +40,2 @@ "repository": { | ||
"dependencies": { | ||
"babel-polyfill": "^6.9.1", | ||
"lodash": "^4.14.0" | ||
@@ -51,3 +50,2 @@ }, | ||
"babel-plugin-istanbul": "^2.0.2", | ||
"babel-plugin-rewire": "^1.0.0-rc-4", | ||
"babel-plugin-transform-class-properties": "^6.11.5", | ||
@@ -58,4 +56,4 @@ "babel-plugin-transform-es3-member-expression-literals": "^6.5.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.8.0", | ||
"babel-plugin-transform-runtime": "^6.8.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"check-es3-syntax-cli": "^0.1.1", | ||
"cross-env": "^1.0.7", | ||
@@ -62,0 +60,0 @@ "eslint": "^3.1.1", |
@@ -28,3 +28,3 @@ import _ from "lodash"; | ||
getIndent() { | ||
return this.indent.repeat(this.indentTypes.length); | ||
return _.repeat(this.indent, this.indentTypes.length); | ||
} | ||
@@ -31,0 +31,0 @@ |
@@ -1,2 +0,1 @@ | ||
import "babel-polyfill"; | ||
import N1qlFormatter from "./languages/N1qlFormatter"; | ||
@@ -3,0 +2,0 @@ import StandardSqlFormatter from "./languages/StandardSqlFormatter"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1
26
734701
18114
- Removedbabel-polyfill@^6.9.1
- Removedbabel-polyfill@6.26.0(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedregenerator-runtime@0.10.50.11.1(transitive)