src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js
function _getValidStepsParams(match) {
        var param,
            def = [ "5", "end" ],
            params = def,
            oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards
            originalString = match[0];

        if (match) {
            match = match[1].split(",");
        }

        if (match) {
            if (match[0]) {
                param = match[0].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
                param = _convertToNumber(param);

                // Verify number_of_params is a number
                // If not, replace it with the default value
                if (!param.isNumber) {
                    param.value = def[0];

                // Round number_of_params to an integer
                } else if (param.value) {
                    param.value = Math.floor(param.value);
                }

                // Verify number_of_steps is >= 1
                // If not, set them to the default value
                if (param.value < 1) {
                    param.value = def[0];
                }
                params[0] = param.value;
            }
            if (match[1]) {
                // little autocorrect feature: leading s gets 'start', everything else gets 'end'
                param = match[1].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
                param = param.substr(0, 1);
                if (param === "s") {
                    params[1] = "start";
                } else {
                    params[1] = "end";
                }
            }
        }
        params = "steps(" + params.join(", ") + ")";
        params = params.match(STEPS_VALID_REGEX);

        if (params) {
            params.index = oldIndex; // re-set the index here to get the right context
            params.originalString = originalString;
            return params;
        }
        return null;
    }
function _getValidStepsParams(match) {
        var param,
            def = [ "5", "end" ],
            params = def,
            oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards
            originalString = match[0];

        if (match) {
            match = match[1].split(",");
        }

        if (match) {
            if (match[0]) {
                param = match[0].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
                param = _convertToNumber(param);

                // Verify number_of_params is a number
                // If not, replace it with the default value
                if (!param.isNumber) {
                    param.value = def[0];

                // Round number_of_params to an integer
                } else if (param.value) {
                    param.value = Math.floor(param.value);
                }

                // Verify number_of_steps is >= 1
                // If not, set them to the default value
                if (param.value < 1) {
                    param.value = def[0];
                }
                params[0] = param.value;
            }
            if (match[1]) {
                // little autocorrect feature: leading s gets 'start', everything else gets 'end'
                param = match[1].replace(/[\s\"']/g, ""); // replace possible trailing whitespace or leading quotes
                param = param.substr(0, 1);
                if (param === "s") {
                    params[1] = "start";
                } else {
                    params[1] = "end";
                }
            }
        }
        params = "steps(" + params.join(", ") + ")";
        params = params.match(STEPS_VALID_REGEX);

        if (params) {
            params.index = oldIndex; // re-set the index here to get the right context
            params.originalString = originalString;
            return params;
        }
        return null;
    }
function _getValidStepsParams ( match ) { var param , def = [ "5" , "end" ] , params = def , oldIndex = match . index , // we need to store the old match.index to re-set the index afterwards originalString = match [ 0 ] ; if ( match ) { match = match [ 1 ] . split ( "," ) ; } if ( match ) { if ( match [ 0 ] ) { param = match [ 0 ] . replace ( / [\s\"'] / g , "" ) ; // replace possible trailing whitespace or leading quotes param = _convertToNumber ( param ) ; // Verify number_of_params is a number // If not, replace it with the default value if ( ! param . isNumber ) { param . value = def [ 0 ] ; // Round number_of_params to an integer } else if ( param . value ) { param . value = Math . floor ( param . value ) ; } // Verify number_of_steps is >= 1 // If not, set them to the default value if ( param . value < 1 ) { param . value = def [ 0 ] ; } params [ 0 ] = param . value ; } if ( match [ 1 ] ) { // little autocorrect feature: leading s gets 'start', everything else gets 'end' param = match [ 1 ] . replace ( / [\s\"'] / g , "" ) ; // replace possible trailing whitespace or leading quotes param = param . substr ( 0 , 1 ) ; if ( param === "s" ) { params [ 1 ] = "start" ; } else { params [ 1 ] = "end" ; } } } params = "steps(" + params . join ( ", " ) + ")" ; params = params . match ( STEPS_VALID_REGEX ) ; if ( params ) { params . index = oldIndex ; // re-set the index here to get the right context params . originalString = originalString ; return params ; } return null ; }
Get valid params for an invalid steps function.

@param {RegExp.match} match (Invalid) matches from stepsMatch()
@return {?RegExp.match} Valid match or null if the output is not valid
Get valid params for an invalid steps function .