Skip to content

Commit

Permalink
fix: drop dependency on string-format-obj (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed May 12, 2020
1 parent 5fda92f commit cf8f58f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -58,7 +58,6 @@
"is": "^3.3.0",
"p-event": "^4.1.0",
"stream-events": "^1.0.5",
"string-format-obj": "^1.1.1",
"uuid": "^8.0.0"
},
"devDependencies": {
Expand Down
25 changes: 10 additions & 15 deletions src/bigquery.ts
Expand Up @@ -20,9 +20,6 @@ import {promisifyAll} from '@google-cloud/promisify';
import arrify = require('arrify');
import {Big} from 'big.js';
import * as extend from 'extend';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const format = require('string-format-obj');
import * as is from 'is';
import * as uuid from 'uuid';

Expand Down Expand Up @@ -1805,12 +1802,11 @@ export class BigQueryDatetime {
if (value.hours) {
time = BigQuery.time(value).value;
}
value = format('{y}-{m}-{d}{time}', {
y: value.year,
m: value.month,
d: value.day,
time: time ? ' ' + time : '',
});
const y = value.year;
const m = value.month;
const d = value.day;
time = time ? ' ' + time : '';
value = `${y}-${m}-${d}${time}`;
} else {
value = value.replace(/^(.*)T(.*)Z$/, '$1 $2');
}
Expand All @@ -1825,12 +1821,11 @@ export class BigQueryTime {
value: string;
constructor(value: BigQueryTimeOptions | string) {
if (typeof value === 'object') {
value = format('{h}:{m}:{s}{f}', {
h: value.hours,
m: value.minutes || 0,
s: value.seconds || 0,
f: is.defined(value.fractional) ? '.' + value.fractional : '',
});
const h = value.hours;
const m = value.minutes || 0;
const s = value.seconds || 0;
const f = is.defined(value.fractional) ? '.' + value.fractional : '';
value = `${h}:${m}:${s}${f}`;
}
this.value = value as string;
}
Expand Down
8 changes: 1 addition & 7 deletions src/table.ts
Expand Up @@ -21,9 +21,6 @@ import arrify = require('arrify');
import Big from 'big.js';
import * as extend from 'extend';
import pEvent from 'p-event';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const format = require('string-format-obj');
import * as fs from 'fs';
import * as is from 'is';
import * as path from 'path';
Expand Down Expand Up @@ -1416,10 +1413,7 @@ class Table extends common.ServiceObject {
},
} as {},
request: {
uri: format('{base}/{projectId}/jobs', {
base: `https://${this.bigQuery.apiEndpoint}/upload/bigquery/v2/projects`,
projectId: this.bigQuery.projectId,
}),
uri: `https://${this.bigQuery.apiEndpoint}/upload/bigquery/v2/projects/${this.bigQuery.projectId}/jobs`,
},
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit cf8f58f

Please sign in to comment.