★ wanayoo — archive 1999 https://github.com/HowProgrammingWorks/HigherOrderFunction/pull/4Nouvelle recherche | Portail wanayoo
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

My work #4

Open
wants to merge 10 commits into
base: master
from
Open

My work #4

wants to merge 10 commits into from

Conversation

@Destaby
Copy link

@Destaby Destaby commented Dec 16, 2019

No description provided.

Destaby added 3 commits Dec 16, 2019
callback(new Error('obj needed'));
return;
}
for (const key in obj) {

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

This will iterate all object keys plus inherited keys from prototype chain.

const contract = (fn, ...types) => null;
const contract = (fn, ...types) => (...arr) => {
for (let i = 1; i < types.length - 1; i++) {
if (typeof fn(...arr) !== types[i].name.toLowerCase()) {

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

Use intermediate variables

throw new TypeError('Types are different');
}
}
return fn(...arr);

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

Check result type

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

Last argument is a result type.

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

Check result type after calling fn

@tshemsedinov
Copy link
Member

@tshemsedinov tshemsedinov commented Dec 16, 2019

Please rebase on master to activate CI

Destaby added 2 commits Dec 16, 2019
@Destaby Destaby changed the title My work My work is redone Dec 16, 2019
throw new TypeError('Types are different');
}
}
return fn(...arr);

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

Check result type after calling fn

if (argType !== neededArgType) {
throw new TypeError('Types are different');
}
if (resultType !== neededReType) {

This comment has been minimized.

@tshemsedinov

tshemsedinov Dec 16, 2019
Member

Why do you check result types in loop?

Destaby added 5 commits Dec 16, 2019
@Destaby Destaby changed the title My work is redone My work Dec 17, 2019
@Destaby
Copy link
Author

@Destaby Destaby commented Dec 17, 2019

@tshemsedinov
Copy link
Member

@tshemsedinov tshemsedinov commented Dec 17, 2019

Please don't send changes in email, commit it directly to git because I need to see diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.