Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: drop dependency on string-format-obj #698

Merged
merged 1 commit into from May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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