Skip to content

Add empty block if parent is non-block statement #8

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

Merged
merged 2 commits into from
Jul 21, 2016

Conversation

twada
Copy link
Member

@twada twada commented Jul 20, 2016

Dealing with IfStatement without curly braces.

refs #7

'use strict';

var assert = require('assert');

function add (a, b) {
    if (!isNaN(a)) assert(0 < a);
    if (typeof b === 'number') {
        assert(0 < b);
    }

    if (typeof a === 'number')
        assert(0 < a);
    else if (typeof b === 'number')
        assert(0 < b);
    else
        assert(false);

    return a + b;
}

becomes

'use strict';
function add(a, b) {
    if (!isNaN(a)) {
    }
    if (typeof b === 'number') {
    }
    if (typeof a === 'number') {
    } else if (typeof b === 'number') {
    } else {
    }
    return a + b;
}

@twada twada merged commit df86fdd into master Jul 21, 2016
@twada twada deleted the non-block-statement branch July 21, 2016 15:38
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.

1 participant