src/tools/general.js
function getOrDefault ( source, path, defaultVal ) {
    var isAlreadySplitted = isArray( path );

    if ( !isDefined(source) ) return defaultVal;
    if ( !isString(path) && !isAlreadySplitted ) return defaultVal;

    var tokens = isAlreadySplitted ? path : path.split( '.' )
      , idx, key;

    for ( idx in tokens ) {
        key = tokens[ idx ];

        if ( isDefined( source[key] ) ) 
            source = source[ key ];
        else 
            return defaultVal;
    }

    return source;
}
function getOrDefault ( source, path, defaultVal ) {
    var isAlreadySplitted = isArray( path );

    if ( !isDefined(source) ) return defaultVal;
    if ( !isString(path) && !isAlreadySplitted ) return defaultVal;

    var tokens = isAlreadySplitted ? path : path.split( '.' )
      , idx, key;

    for ( idx in tokens ) {
        key = tokens[ idx ];

        if ( isDefined( source[key] ) ) 
            source = source[ key ];
        else 
            return defaultVal;
    }

    return source;
}
function getOrDefault ( source , path , defaultVal ) { var isAlreadySplitted = isArray ( path ) ; if ( ! isDefined ( source ) ) return defaultVal ; if ( ! isString ( path ) && ! isAlreadySplitted ) return defaultVal ; var tokens = isAlreadySplitted ? path : path . split ( '.' ) , idx , key ; for ( idx in tokens ) { key = tokens [ idx ] ; if ( isDefined ( source [ key ] ) ) source = source [ key ] ; else return defaultVal ; } return source ; }
Returns path's value or null if path's chain has undefined member.
@param {Object} source - root object.
@param {string} path - path to `source` value.
@return {Object}
Returns path s value or null if path s chain has undefined member .