diff --git a/.babelrc b/.babelrc index c13c5f6..002b4aa 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,3 @@ { - "presets": ["es2015"] + "presets": ["env"] } diff --git a/package.json b/package.json index d23afbd..95e0686 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/arrays.js b/src/arrays.js index b995952..f844408 100644 --- a/src/arrays.js +++ b/src/arrays.js @@ -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]; }; diff --git a/src/class.js b/src/class.js index 8276e29..a58bfd3 100644 --- a/src/class.js +++ b/src/class.js @@ -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 ` meowed!` where `` is the `name` // property set on the Cat instance.