Skip to content

Commit

Permalink
Removed unneeded use of _.isArray with _.isObjectLike
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodgkins committed Aug 11, 2021
1 parent cc49b11 commit fae1bf0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/v1/providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export class DataSnapshot {
// Null value
return false;
}
if ((_.isObjectLike(val) || _.isArray(val)) && _.isEmpty(val)) {
if (_.isObjectLike(val) && _.isEmpty(val)) {
// Empty object/array
return false;
}
Expand Down Expand Up @@ -521,7 +521,7 @@ export class DataSnapshot {
*/
forEach(action: (a: DataSnapshot) => boolean | void): boolean {
const val = this.val();
if (_.isObjectLike(val) || _.isArray(val)) {
if (_.isObjectLike(val)) {
return _.some(
val,
(value, key: string) => action(this.child(key)) === true
Expand Down Expand Up @@ -555,7 +555,7 @@ export class DataSnapshot {
*/
hasChildren(): boolean {
const val = this.val();
return (_.isObjectLike(val) || _.isArray(val)) && !_.isEmpty(val);
return _.isObjectLike(val) && !_.isEmpty(val);
}

/**
Expand All @@ -565,7 +565,7 @@ export class DataSnapshot {
*/
numChildren(): number {
const val = this.val();
return _.isObjectLike(val) || _.isArray(val) ? _.keys(val).length : 0;
return _.isObjectLike(val) ? _.keys(val).length : 0;
}

/**
Expand Down

0 comments on commit fae1bf0

Please sign in to comment.