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

Deprecate Collection#size(), add Collection#length #151

Merged
merged 1 commit into from Sep 21, 2016

Conversation

DrewML
Copy link
Contributor

@DrewML DrewML commented Sep 18, 2016

Implements #150 (assuming it is wanted).

I was going to use util.deprecate, but cannot do that without using the class fields proposal, so I'm just writing a warning to stderr atm.

EditorConfig setup in Atom killed some extra whitespace. Happy to revert if requested.

@ghost ghost added the CLA Signed label Sep 18, 2016
@vjeux
Copy link
Contributor

vjeux commented Sep 18, 2016

<3

Any thoughts @fkling?

@@ -110,6 +110,16 @@ class Collection {
* @return {number}
*/
size() {
process.stderr.write('Collection#size() is deprecated. Use Collection#length instead');
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see much harm supporting both. I would just add the other one and not deprecate this one.

@ghost ghost added the CLA Signed label Sep 18, 2016
@fkling
Copy link
Contributor

fkling commented Sep 19, 2016

👍 I also think there is no need to add a deprecation warning. Rest looks good to me 😄

@DrewML
Copy link
Contributor Author

DrewML commented Sep 19, 2016

Removed deprecation. @fkling how do you want me to handle tests for size(). I can add an assertion on size() in every test that we check length in, or I can just add 1 explicit test to ensure that size() and length return the same value.

@ghost ghost added the CLA Signed label Sep 19, 2016
@fkling
Copy link
Contributor

fkling commented Sep 21, 2016

I'm actually OK with as it is. No need to add tests back.

@fkling fkling merged commit dad65e6 into facebook:master Sep 21, 2016
euphocat pushed a commit to euphocat/jscodeshift that referenced this pull request Oct 22, 2017
**what is the change?:**
`npm` -> `yarn`

**why make this change?:**
I personally find it confusing to have 'npm' in the docs when I'm trying
to use 'yarn' consistently.

**test plan:**
Visual inspection
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.

None yet

3 participants