* Normalize undefined type checks in collections with typeof operators.
* Remove redundant number type checking in collections.
Number.isInteger() throws false for strings and any other types that aren't numbers.
Since the return value of Collection#exists is basically just a boolean of Collection#find's result, the same documentation and arguments can and should be applied.
* Add `count` optional argument to Collection methods
[NON-BREAKING CHANGE]
An optional `count` argument is added to the following methods:
- random() and randomKey()
- first() and firstKey()
- last() and lastKey()
If `count` is used, the method returns an array instead of only the value. Performance impact non-existent for existing code. Performance for returning an array has been measured and this is the fastest I could find (array[i] = value is faster than array.push()).
* Update Collection.js
Fixed spacing/line length errors according to suggestions by codacy/pr
* Fixed docs
Added proper `@returns {*|Array}` as the methods might return either. Also added params where missing (whoops)
* Further doc fixes
Per Crawl's comments, fixed (i + 1) spacing as well as fixed {Integer} to {number}
* random() and randomKey() fix
Per Hydra's comment, random() and randomKey() now ensures unique values.
I've also resolved potential issues with requesting a count higher than the collection size. A collection with 10 items will only ever return at most 10 items using the `count` property.
* Can I facepalm harder
Had wrong header comments ^_^
* Fixed for "values/value" and Omited
Also, added "Positive" integer check.
* looks like I "omitted" a change, there.
* Update Collection.js
* Update Collection.js
* Update Collection.js
* make role calculated position nicer
* make channels sortable in a nice way too
* stupid git web rebase editor
* Update Guild.js
* Update Guild.js
* Update Guild.js
* Update Guild.js
* Update RESTMethods.js
* Docs update
Changed the param names and param descriptions to be consistent.
* Added === comparison
Changed Presence.equals and Game.equals to first compare using ===
* Collection.equals fix
Now returns false when collection is undefined, instead of crashing
💯
Adds an equals function that checks for differing size and differing
key-value pairs, and takes into account the edge case for when there's
an entry for the key, but the value is undefined.
* Cache array and keyArray in Collection
Cache array and keyArray in the Collection class to improve consecutive
calls of collection.random() by around 400,000%, I think lel.
The speed decrease (I assume) compared to the previous version when
calling after it has changed is most likely negligible.
* Fix for ESLint
I think this fixes it.