Created
June 15, 2017 19:35
-
-
Save iCodeForBananas/42a557d326c86b313f4bac049f4887f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const questions = [ | |
| { | |
| question: 'Select the method that returns the underlying array represented by the collection', | |
| method: 'all', | |
| codeExample: ` | |
| collect([1, 2, 3]).all(); | |
| //=> [1, 2, 3] | |
| `, | |
| documentationLink: 'https://github.com/ecrmnn/collect.js#all' | |
| }, | |
| { | |
| question: 'Select the method that returns the average of all items in a collection', | |
| method: 'avg or average', | |
| codeExample: ` | |
| collect([1, 3, 3, 7]).avg(); | |
| //=> 3.5 | |
| `, | |
| documentationLink: 'https://github.com/ecrmnn/collect.js#avg' | |
| }, | |
| { | |
| question: 'Select the method that breaks the collection into smaller collections of a given size', | |
| method: 'chunk', | |
| codeExample: ` | |
| const collection = collect([1, 2, 3, 4, 5, 6, 7]); | |
| const chunks = collection.chunk(4); | |
| chunks.all(); | |
| //=> [[1, 2, 3, 4], [5, 6, 7]] | |
| `, | |
| documentationLink: 'https://github.com/ecrmnn/collect.js#chunk' | |
| }, | |
| { | |
| question: 'Select the method that returns the average of all items in a collection', | |
| method: 'avg or average', | |
| description: 'The avg method returns the average of all items in the collection.', | |
| codeExample: ` | |
| collect([1, 3, 3, 7]).avg(); | |
| //=> 3.5 | |
| `, | |
| documentationLink: 'https://github.com/ecrmnn/collect.js#avg' | |
| }, | |
| { | |
| question: 'Select the method that collapses a collection of arrays into a single, flat collection', | |
| method: 'collapse', | |
| codeExample: ` | |
| const collection = collect([[1], [{}, 5, {}], ['xoxo']]); | |
| const collapsed = collection.collapse(); | |
| collapsed.all(); | |
| //=> [1, {}, 5, {}, 'xoxo'] | |
| `, | |
| documentationLink: 'https://github.com/ecrmnn/collect.js#collapse' | |
| }, | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment