Commit Graph

62 Commits

Author SHA1 Message Date
Lewdcario
09ddbcb88a chore: deprecations 2018-05-12 00:40:12 -05:00
1Computer1
de7d90ada3 feat(Collection): add tap method (#2507)
* Add Collection#inspect

* No u

* Rename to tap

* Rename variable

* Do it here too
2018-05-09 16:46:54 +02:00
bdistin
2b6592ed54 feat(Collection): add sweep method (#2528) 2018-05-09 16:42:28 +02:00
bdistin
b757f9ef2d docs(Collection): fix spelling of 'behavior' (#2529) 2018-05-08 19:07:49 +02:00
Kyra
b7851bad37 perf(Collection): Performance improvements (#2342)
* Update Collection.js

* ESLint
2018-02-21 22:03:40 +01:00
Frangu Vlad
0821acfa99 Fix iter issues (#2237) 2018-01-09 21:17:46 +01:00
Évelyne Lachance
d513c4bbb9 Add count optional argument to Collection methods (#1552)
* 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
2017-08-12 11:18:25 +02:00
Crawl
ac92d2cecc Improve docs a bit 2017-04-30 04:30:44 +02:00
Gus Caplan
a4e0af2e45 make positions for channels and roles nicer (#1211)
* 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
2017-04-01 08:28:54 +02:00
Gus Caplan
dd3831fa1e Remove type error from Collection#exists() (#1320) 2017-03-30 11:01:07 -04:00
bdistin
25bb602d5a Add Collection.clone() (#1238)
* Add Collection.clone()

* More efficient cloning, and concat update

* Update Collection.js

* Update Collection.js
2017-03-01 04:41:36 -05:00
Gus Caplan
1e6abe587b no more (#1117) 2017-01-19 17:10:54 +00:00
Zack Campbell
b68283e57a Make _array & _keyArray non-enumerable (#1075)
Because Map has no enumerable properties
2017-01-08 11:59:45 +00:00
Amish Shah
fde3a976aa Revert "This expands the consistency of .find and .exists to include the id property" (#1074) 2017-01-08 10:17:10 +00:00
Jacob
2a668ac997 This expands the consistency of .find and .exists to include the id property (#1072)
* provide a more consistent api for .find

* remove random warning

* make code more concise
2017-01-08 09:02:44 +00:00
Schuyler Cebulskie
28ca83011c Implement missing Collection#reduce functionality 2016-12-24 01:59:14 -05:00
Alexander
264ee8e7f1 Equals updates (#987)
* 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
💯
2016-12-14 17:10:34 -05:00
Schuyler Cebulskie
bd00bc404c Make Collection#set/delete return the result of the super call, and clean up equals docs 2016-12-03 21:38:27 -05:00
Slamakans
a0b245bfe1 equals function added (#948)
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.
2016-12-03 21:34:26 -05:00
Schuyler Cebulskie
ac64f8bd23 Improve rest args docs 2016-11-24 11:22:13 -05:00
Schuyler Cebulskie
2bb5aa1fda Change Collection description 2016-11-20 18:05:01 -05:00
Schuyler Cebulskie
a80a64f8ce Update Collection docs some more 2016-11-20 17:59:54 -05:00
Schuyler Cebulskie
74ab72fdea Update Collection docs 2016-11-20 17:39:55 -05:00
Schuyler Cebulskie
bb3b709d6e Nothing to see here 👀 2016-11-13 01:13:13 -05:00
Schuyler Cebulskie
da9d1a3daf Don't mind me 2016-11-13 01:07:48 -05:00
Schuyler Cebulskie
ee3a03f707 Make Collection.find/exists error when using with IDs 2016-11-13 00:27:56 -05:00
Schuyler Cebulskie
b07a31d44e Change case of "function" 2016-11-12 21:07:22 -05:00
Schuyler Cebulskie
90304aa7d6 Fix loads of JSDoc type issues 2016-11-12 20:52:37 -05:00
Schuyler Cebulskie
a673a97441 Rephrase Collection.find/exists slightly 2016-10-30 22:28:06 -04:00
Schuyler Cebulskie
d7e1e1c0c9 Add warnings for Collection.find/exists 2016-10-30 22:22:16 -04:00
Schuyler Cebulskie
6baf43dc24 Add Collection.filterArray 2016-10-15 01:20:31 -04:00
Schuyler Cebulskie
93425c3979 Expand collection array caching 2016-10-04 19:10:29 -04:00
Schuyler Cebulskie
2c3c91fe41 Merge branch 'master' into indev 2016-10-04 19:02:09 -04:00
Slamakans
53f5c2cb52 Cache array and keyArray in Collection (#771)
* 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.
2016-10-04 18:53:26 -04:00
Schuyler Cebulskie
0bcca7bb55 Add Collection.concat 2016-09-27 20:47:12 -04:00
Kelvin Wu
bd465108a7 Fix return type in docs. 2016-09-24 11:58:51 -04:00
Schuyler Cebulskie
737ad8e92b Slightly improve some Collection docs 2016-09-22 21:36:06 -04:00
Schuyler Cebulskie
9cd249342b Teensy reorganisation 2016-09-12 21:40:15 -04:00
Schuyler Cebulskie
ac85ffce4b Add Collection.keyArray/firstKey/lastKey/randomKey 2016-09-12 21:39:41 -04:00
Schuyler Cebulskie
84b33f9b66 Add Collection.reduce 2016-09-12 21:33:29 -04:00
Schuyler Cebulskie
fba3508079 Add a little more detail about value 2016-09-12 02:52:32 -04:00
Schuyler Cebulskie
2aae20085b Key -> Property 2016-09-12 02:20:53 -04:00
Schuyler Cebulskie
e24c1e55a0 Remove wholly unnecessary example 2016-09-12 00:33:24 -04:00
Schuyler Cebulskie
7457985e60 Fix Collection.findKey doc link 2016-09-12 00:28:27 -04:00
Schuyler Cebulskie
95605863c7 Add Collection.findKey 2016-09-12 00:26:02 -04:00
Schuyler Cebulskie
ac1f5f32e2 Add Collection.find with function 2016-09-12 00:18:21 -04:00
Schuyler Cebulskie
47d71d32f3 Make grammer gooder 2016-09-11 01:40:37 -04:00
Schuyler Cebulskie
594836b1bf Rewrite Collection.map/filter, and add some/every 2016-09-08 02:26:28 -04:00
Amish Shah
7b870d13de Fix collection.find/findAll docs 2016-09-04 21:41:19 +01:00
Amish Shah
4d2bb891a9 Fix doc gen 2016-09-04 11:39:40 +01:00