Explorar el Código

Improved type validation

Taichi Masuyama hace 4 años
padre
commit
6426bed56e
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      packages/app/src/server/models/user-group.js

+ 2 - 2
packages/app/src/server/models/user-group.js

@@ -79,8 +79,8 @@ class UserGroup {
   }
 
   static async findChildUserGroupsByParentIds(parentIds, includeGrandChildren = false) {
-    if (parentIds == null) {
-      throw Error('parentIds must not be null.');
+    if (!Array.isArray(parentIds)) {
+      throw Error('parentIds must be an array.');
     }
 
     const childUserGroups = await this.find({ parent: { $in: parentIds } });