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

Add two isType methods, for Promise and Generator #2739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zzq0826
Copy link

@zzq0826 zzq0826 commented Apr 8, 2018

var promise1 = new Promise(function(resolve, reject) {
setTimeout(resolve, 100, 'foo');
});
_.isPromise(promise1)
//[object Promise]

function* gen() {
yield 1;
yield 2;
yield 3;
}
let g = gen();
_.isGenerator(g)
//[object Generator]

@jgonggrijp
Copy link
Collaborator

@zzq0826 Thank you for your contribution and apologies for the long silence. You'd be welcome to finish this PR. The structure of upstream Underscore has changed considerably in the meanwhile, however, so you'd basically have to start over:

  1. git checkout master.
  2. Pull latest version of the master branch into your local clone.
  3. npm run install: this updates the dev dependencies and installs commit hooks.
  4. git checkout dev.
  5. git reset --hard master.
  6. Create modules/isGenerator.js and modules/isPromise.js. You can imitate the code from modules/isArrayBuffer.js.
  7. Add isGenerator and isPromise to modules/index.js.
  8. Add tests for isGenerator and isPromise to test/objects.js.
  9. Add documentation for these functions to the index.html.

Please let me know whether you'd still like to make this contribution.

@jgonggrijp jgonggrijp self-assigned this Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants