Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
fix: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
justinlettau committed Jun 11, 2018
1 parent 6aa45d1 commit a0324d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/commands/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
PrimaryKeyRecordSet,
SchemaRecordSet,
TableRecordSet,
TvpRecordSet,
TvpRecordSet
} from '../sql/record-set';
import * as script from '../sql/script';
import { columnRead, foreignKeyRead, indexRead, objectRead, primaryKeyRead, tableRead, tvpRead } from '../sql/sys';
Expand Down Expand Up @@ -51,7 +51,7 @@ export function pull(name: string): void {
...config.data.map(table => {
return pool.request()
.query(`select * from ${table}`)
.then(result => ({ name: table, type: 'DATA', result }))
.then(result => ({ name: table, type: 'DATA', result }));
})
]).then(results => {
pool.close();
Expand Down Expand Up @@ -230,19 +230,19 @@ function createFile(config: Config, item: any, file: string, content: string): s
/**
* Check if a file passes the glob pattern.
*
* @param glob Glob pattern to check against.
* @param files Glob pattern to check against.
* @param file File path to check.
*/
function include(glob: string[], file: string | string[]): boolean {
if (!glob || !glob.length) {
function include(files: string[], file: string | string[]): boolean {
if (!files || !files.length) {
return true;
}

if (!isArray(file)) {
file = [file];
}

const results: string[] = multimatch(file, glob);
const results: string[] = multimatch(file, files);
return !!results.length;
}

Expand Down
10 changes: 5 additions & 5 deletions src/sql/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
IndexRecordSet,
PrimaryKeyRecordSet,
SchemaRecordSet,
TableRecordSet,
TableRecordSet
} from '../sql/record-set';

/**
Expand Down Expand Up @@ -165,7 +165,7 @@ export function table(
.forEach(ix => {
output += index(ix);
output += EOL;
})
});

return output;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ export function data(item: DataRecordSet): string {
item.result.recordset.forEach(row => {
const keys: string[] = Object.keys(row);
const columns: string = keys.join(', ');
const values: string = keys.map(key => value(row[key])).join(', ');
const values: string = keys.map(key => safeValue(row[key])).join(', ');

output += `insert into ${item.name} (${columns}) values (${values})`;
output += EOL;
Expand All @@ -236,9 +236,9 @@ export function data(item: DataRecordSet): string {
*
* @param value SQL data value.
*/
function value(value: any): any {
function safeValue(value: any): any {
if (isString(value)) {
value = value.replace(`'`, `''`);
value = value.replace("'", "''");
return `'${value}'`;
}

Expand Down

0 comments on commit a0324d3

Please sign in to comment.