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

chore(deps): update dependencies #171

Merged
merged 18 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f81fbd4
chore(deps-dev): bump @types/node from 14.14.34 to 14.14.35
dependabot[bot] Mar 16, 2021
00345ce
chore(deps-dev): bump config from 3.3.3 to 3.3.6
dependabot[bot] Mar 16, 2021
91acf06
chore(deps-dev): bump typescript from 4.1.2 to 4.2.3
dependabot[bot] Mar 16, 2021
addc139
chore(deps-dev): bump ts-jest from 26.4.4 to 26.5.3
dependabot[bot] Mar 16, 2021
298ab88
chore(deps-dev): bump @commitlint/cli from 11.0.0 to 12.0.1
dependabot[bot] Mar 16, 2021
fc2430c
chore(deps-dev): bump @commitlint/config-conventional
dependabot[bot] Mar 16, 2021
c0f0e95
chore(deps-dev): bump husky from 5.0.6 to 5.1.3
dependabot[bot] Mar 16, 2021
80e367f
chore(deps-dev): bump eslint-config-prettier from 7.1.0 to 8.1.0
dependabot[bot] Mar 16, 2021
cbf5009
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
cc2ff47
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
d5eec52
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
e9a2ef1
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
d99cfe8
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
1fd85f0
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
65a2696
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
0ae4daf
Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/…
rintaun Mar 17, 2021
ae6fc42
refactor: array detection type assertion
rintaun Mar 17, 2021
881e881
chore: remove obsolete linter config
rintaun Mar 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
'plugin:jsonc/auto-config',
],
parser: '@typescript-eslint/parser',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"yargs": "^16.1.1"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@commitlint/cli": "^12.0.1",
"@commitlint/config-conventional": "^12.0.1",
"@databases/pg-test": "^3.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
Expand All @@ -63,7 +63,7 @@
"@typescript-eslint/parser": "^4.9.1",
"config": "^3.3.3",
"eslint": "^7.15.0",
"eslint-config-prettier": "^7.0.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-jsonc": "^1.2.1",
"eslint-plugin-prettier": "^3.2.0",
"husky": "^5.0.0",
Expand Down
11 changes: 7 additions & 4 deletions src/datasource/DBDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export type LoaderCallback<TResultType> = (
const parseTS = (value: number): Date | null =>
value === null ? null : new Date(value)

const isArray = <T extends unknown[] | readonly unknown[], U>(
value: T | U
): value is T => Array.isArray(value)

export default class DBDataSource<
TRowType,
TContext = unknown,
Expand Down Expand Up @@ -212,11 +216,10 @@ export default class DBDataSource<
options: QueryOptions<TRowType> = {}
): Promise<TRowType | readonly TRowType[] | null> {
if (!options.expected) {
options.expected =
!Array.isArray(rows) || rows.length === 1 ? 'one' : 'many'
options.expected = !isArray(rows) || rows.length === 1 ? 'one' : 'many'
}

if (Array.isArray(rows) && rows.length === 0) {
if (isArray(rows) && rows.length === 0) {
switch (options.expected) {
case 'one': // we should really raise here, strictly speaking
case 'maybeOne':
Expand Down Expand Up @@ -419,7 +422,7 @@ export default class DBDataSource<
return
}

if (!Array.isArray(results)) {
if (!isArray(results)) {
results = [results]
}

Expand Down
Loading