From dd2c3c1f8c5ed586c0292a4e87af2f2cd6f6c3ef Mon Sep 17 00:00:00 2001 From: Snowflake Date: Mon, 14 Dec 2020 13:32:13 +0545 Subject: [PATCH] lint --- src/utils/collection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/collection.ts b/src/utils/collection.ts index ee77f4a..faf8590 100644 --- a/src/utils/collection.ts +++ b/src/utils/collection.ts @@ -28,7 +28,7 @@ export class Collection extends Map { const arr = this.array() if (typeof amount === 'undefined') return arr[arr.length - 1] if (amount < 0) return this.first(amount * -1) - if (!amount) return [] + if (typeof amount !== 'number' && !amount) return [] return arr.slice(-amount) } @@ -38,7 +38,7 @@ export class Collection extends Map { random(amount?: number): V | V[] { let arr = this.array() if (typeof amount === 'undefined') return arr[Math.floor(Math.random() * arr.length)] - if (arr.length === 0 || !amount) return [] + if (arr.length === 0 || typeof amount !== 'number' && !amount) return [] arr = arr.slice() return Array.from({ length: amount }, (): V => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]) }