Skip to content

fix: use isArray util function to check the type of the array#596

Merged
kiaking merged 1 commit into
masterfrom
fix-array-type-check
Mar 11, 2020
Merged

fix: use isArray util function to check the type of the array#596
kiaking merged 1 commit into
masterfrom
fix-array-type-check

Conversation

@kiaking

@kiaking kiaking commented Mar 11, 2020

Copy link
Copy Markdown
Member

When checking a value is a type of array, using foo instanceof Array was causing false negative in Nuxt server side env. It's fixed by using Array.isArray() instead.

This PR adds isArray utility function, and replaces all Array.isArray() and foo instanceof Array condition checks.

Type of PR:

  • Bugfix
  • Feature
  • Enhancement
  • Documentation
  • Other

Breaking changes:

  • No
  • Yes

`instanceof` check was causing false negative in Nuxt server side env. It's fixed
by using `Array.isArray()` instead.
@kiaking kiaking added the bug Something isn't working label Mar 11, 2020
@kiaking kiaking self-assigned this Mar 11, 2020
@kiaking kiaking added this to the v1.0.0 milestone Mar 11, 2020
@codecov

codecov Bot commented Mar 11, 2020

Copy link
Copy Markdown

Codecov Report

Merging #596 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #596   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          47     47           
  Lines        1904   1910    +6     
  Branches      270    270           
=====================================
+ Hits         1904   1910    +6
Impacted Files Coverage Δ
src/attributes/relations/Relation.ts 100% <100%> (ø) ⬆️
src/attributes/relations/MorphedByMany.ts 100% <100%> (ø) ⬆️
src/modules/Actions.ts 100% <100%> (ø) ⬆️
src/schema/IdAttribute.ts 100% <100%> (ø) ⬆️
src/attributes/relations/BelongsToMany.ts 100% <100%> (ø) ⬆️
src/query/loaders/Loader.ts 100% <100%> (ø) ⬆️
src/attributes/relations/MorphToMany.ts 100% <100%> (ø) ⬆️
src/query/processors/Normalizer.ts 100% <100%> (ø) ⬆️
src/query/rollcallers/Rollcaller.ts 100% <100%> (ø) ⬆️
src/query/filters/WhereFilter.ts 100% <100%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04909f9...d8b57a8. Read the comment docs.

@kiaking kiaking merged commit 900c9af into master Mar 11, 2020
@kiaking kiaking deleted the fix-array-type-check branch March 11, 2020 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant