Skip to content
This repository was archived by the owner on Aug 31, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015"]
"presets": ["env"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"regenerator-runtime": "^0.10.3"
},
"dependencies": {
"babel-preset-es2015": "^6.24.0",
"babel-preset-env": "^1.6.1",
"eslint-config-airbnb": "^14.1.0"
}
}
10 changes: 8 additions & 2 deletions src/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,41 @@
// You can use the functions that you have already written to help solve the other problems

const each = (elements, cb) => {
// Reproduce the functionality of forEach from scratch.
// Iterates over a list of elements, yielding each in turn to the `cb` function.
// This only needs to work with arrays.
// based off http://underscorejs.org/#each
};

const map = (elements, cb) => {
// Produces a new array of values by mapping each value in list through a transformation function (iteratee).
// Return the new array.
// Reproduce the functionality of map from scratch.
// Return a new array of values by mapping each value in a array through a transformation function (iteratee).
};

const reduce = (elements, cb, memo = elements.shift()) => {
// Reproduce the functionality of reduce from scratch.
// Combine all elements into a single value going from left to right.
// Elements will be passed one by one into `cb`.
// `memo` is the starting value. If `memo` is undefined then make `elements[0]` the initial value.
// Return the product of the callback.
};

const find = (elements, cb) => {
// Reproduce the functionality of find from scratch.
// Look through each value in `elements` and pass each element to `cb`.
// If `cb` returns `true` then return that element.
// Return `undefined` if no elements pass the truth test.
};

const filter = (elements, cb) => {
// Reproduce the functionality of filter from scratch.
// Similar to `find` but you will return an array of all elements that passed the truth test
// Return an empty array if no elements pass the truth test
};

/* Extra Credit */
const flatten = (elements) => {
// Reproduce the functionality of flatten from scratch.
// Flattens a nested array (the nesting can be to any depth).
// Example: flatten([1, [2], [3, [[4]]]]); => [1, 2, 3, 4];
};
Expand Down
2 changes: 1 addition & 1 deletion src/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// `Cat` should extend the `Animal` class.
// Animal and Cat should both have a parameter called `options` in their constructors.
// Animal should have the property `age` that's set in the constructor and the method
// `growOlder` that returns the age.
// `growOlder` that returns the age incremented by one.
// Cat should have the property `name` that is set in the constructor and the method
// `meow` that should return the string `<name> meowed!` where `<name>` is the `name`
// property set on the Cat instance.
Expand Down