Skip to content

Commit

Permalink
Covered edge case of non existing element
Browse files Browse the repository at this point in the history
  • Loading branch information
mahammad-mostafa committed Aug 4, 2023
1 parent 5d24d7a commit dc7d5fa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/items.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export default (list) => list.childElementCount;
export default (list) => {
if (list === null || list === undefined) {
throw new Error('List does not exist!');
}
return list.childElementCount;
};

0 comments on commit dc7d5fa

Please sign in to comment.