Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flatMap.ts #5771

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/before.ts
Expand Up @@ -13,12 +13,12 @@
* jQuery(element).on('click', before(5, addContactToList))
* // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
export const before = (n, func) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export const doesn't do default export

let result;
if (typeof func !== 'function') {
throw new TypeError('Expected a function');
}
return function (...args) {
return (...args) => {
if (--n > 0) {
result = func.apply(this, args);
}
Expand All @@ -29,4 +29,3 @@ function before(n, func) {
};
}

export default before;
4 changes: 1 addition & 3 deletions src/capitalize.ts
Expand Up @@ -14,6 +14,4 @@ import toString from './toString.js';
* capitalize('FRED')
* // => 'Fred'
*/
const capitalize = (string) => upperFirst(toString(string).toLowerCase());

export default capitalize;
export default const capitalize = (string) => upperFirst(toString(string).toLowerCase());
6 changes: 2 additions & 4 deletions src/flatMap.ts
Expand Up @@ -21,8 +21,6 @@ import map from './map.js';
* flatMap([1, 2], duplicate)
* // => [1, 1, 2, 2]
*/
function flatMap(collection, iteratee) {
return baseFlatten(map(collection, iteratee), 1);
}
export default const flatMap = (collection, iteratee) => baseFlatten(map(collection, iteratee), 1);


export default flatMap;
6 changes: 1 addition & 5 deletions src/flatMapDeep.ts
Expand Up @@ -23,8 +23,4 @@ const INFINITY = 1 / 0;
* flatMapDeep([1, 2], duplicate)
* // => [1, 1, 2, 2]
*/
function flatMapDeep(collection, iteratee) {
return baseFlatten(map(collection, iteratee), INFINITY);
}

export default flatMapDeep;
export const flatMapDeep = (collection, iteratee) => baseFlatten(map(collection, iteratee), INFINITY);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export const doesn't do default export

3 changes: 1 addition & 2 deletions src/flatMapDepth.ts
Expand Up @@ -21,9 +21,8 @@ import map from './map.js';
* flatMapDepth([1, 2], duplicate, 2)
* // => [[1, 1], [2, 2]]
*/
function flatMapDepth(collection, iteratee, depth) {
export const flatMapDepth = (collection, iteratee, depth) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export const doesn't do default export

depth = depth === undefined ? 1 : +depth;
return baseFlatten(map(collection, iteratee), depth);
}

export default flatMapDepth;