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

mixin lodash _.chain().value() not work #33

Closed
HoKangInfo opened this issue Dec 5, 2017 · 4 comments
Closed

mixin lodash _.chain().value() not work #33

HoKangInfo opened this issue Dec 5, 2017 · 4 comments
Labels

Comments

@HoKangInfo
Copy link

HoKangInfo commented Dec 5, 2017

const _ = require('lodash');
const Aigle = require('aigle');
Aigle.mixin(_);

function asyncFunc(n) {
return new Promise(resolve => setTimeout(resolve, 10, n * 2));
}

main=async function() {
// example 1
const array = [1, 2, 3];
const result_1 = await Aigle.map(array, asyncFunc);

// example 2
const result_2 = await Aigle.chain(array)
.map(asyncFunc)
.sum()
.value();
// or
const result_3 = await Aigle.resolve(array)
.map(asyncFunc)
.sum();

const result_4 = await Aigle.map(array, asyncFunc)
.sum();

console.log(result_1,result_2,result_3,result_4)
}()
// ==> [ 2, 4, 6 ] undefined 12 12
// should result_2 == result_4
├─┬ [email protected]
│ └── [email protected]
├── [email protected]

@HoKangInfo
Copy link
Author

├─┬ [email protected]
│ └── [email protected]
├── [email protected]
// ==> [ 2, 4, 6 ] 12 12 12
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
// ==>[ 2, 4, 6 ] undefined 12 12

@suguru03
Copy link
Owner

suguru03 commented Dec 5, 2017

Thank you for the issue.
I deleted the value on this commit, but I think it should have the value.

I'll revert the changes, thanks 😄

@suguru03 suguru03 added the bug label Dec 5, 2017
suguru03 added a commit that referenced this issue Dec 5, 2017
@HoKangInfo
Copy link
Author

THX, You did what I needed.
I use lodash and async. now, i can use Aigle every place.

@suguru03
Copy link
Owner

suguru03 commented Dec 5, 2017

@HoKangInfo
I just published it on v1.9.2!
Thanks for using Aigle, I'm really grateful! 😄

@suguru03 suguru03 closed this as completed Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants