Skip to content

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