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

compatible with generator function #75

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

iamnotstone
Copy link

In some times the function can be a generator. So have to write the set function in this way:

set(key, value){
  if(typeof value.next === 'function'){                                       
    let result                                                                
     result = value.next()                                                     
     while(!result.done){                                                      
       result = value.next()                                                   
     }                                                                         
     return store[key] = result.value                                                 
  }                                                                           
  else                                                                        
     return store[key] = value
}

to enable this, I have to make some difference in source code. hope this is helpful!

@codecov-io
Copy link

codecov-io commented Jun 29, 2019

Codecov Report

Merging #75 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #75   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files           1        1           
  Lines          37       37           
  Branches        8       10    +2     
=======================================
  Hits           36       36           
  Misses          1        1
Impacted Files Coverage Δ
src/index.js 97.29% <100%> (ø) ⬆️

@caiogondim
Copy link
Owner

Could you push some tests for it as well?

@iamnotstone
Copy link
Author

test code added

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

Successfully merging this pull request may close these issues.

None yet

3 participants