Skip to content

Commit

Permalink
refactor: move functions to utilities
Browse files Browse the repository at this point in the history
PR-URL: #14
  • Loading branch information
tshemsedinov committed Sep 11, 2020
1 parent 0002db9 commit 0edc111
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions lib/ddl.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
'use strict';

const { DatabaseSchema } = require('./schema-db.js');

const toLowerCamel = s => s.charAt(0).toLowerCase() + s.slice(1);
const toUpperCamel = s => s.charAt(0).toUpperCase() + s.slice(1);
const isUpperCamel = s => s[0] === s[0].toUpperCase();
const { toLowerCamel, toUpperCamel, isUpperCamel } = require('./utils.js');

const DB_RELATION = 1;
const DB_FIELD = 2;
Expand Down
7 changes: 7 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ const joinIterable = (val, sep) => {
return res;
};

const toLowerCamel = s => s.charAt(0).toLowerCase() + s.slice(1);
const toUpperCamel = s => s.charAt(0).toUpperCase() + s.slice(1);
const isUpperCamel = s => !!s && s[0] === s[0].toUpperCase();

module.exports = {
escapeIdentifier,
escapeKey,
mapJoinIterable,
joinIterable,
toLowerCamel,
toUpperCamel,
isUpperCamel,
};

0 comments on commit 0edc111

Please sign in to comment.