lib/core.js
function _first_split(character, string){

    var retlist = null;
    
    var eq_loc = string.indexOf(character);
    if( eq_loc == 0 ){
	retlist = ['', string.substr(eq_loc +1, string.length)];
    }else if( eq_loc > 0 ){
	var before = string.substr(0, eq_loc);
	var after = string.substr(eq_loc +1, string.length);
	retlist = [before, after];
    }else{
	retlist = ['', ''];
    }
    
    return retlist;
}
function _first_split(character, string){

    var retlist = null;
    
    var eq_loc = string.indexOf(character);
    if( eq_loc == 0 ){
	retlist = ['', string.substr(eq_loc +1, string.length)];
    }else if( eq_loc > 0 ){
	var before = string.substr(0, eq_loc);
	var after = string.substr(eq_loc +1, string.length);
	retlist = [before, after];
    }else{
	retlist = ['', ''];
    }
    
    return retlist;
}
function _first_split ( character , string ) { var retlist = null ; var eq_loc = string . indexOf ( character ) ; if ( eq_loc == 0 ) { retlist = [ '' , string . substr ( eq_loc + 1 , string . length ) ] ; } else if ( eq_loc > 0 ) { var before = string . substr ( 0 , eq_loc ) ; var after = string . substr ( eq_loc + 1 , string . length ) ; retlist = [ before , after ] ; } else { retlist = [ '' , '' ] ; } return retlist ; }
Attempt to return a two part split on the first occurrence of a
character.

Returns '' for parts not found.

Unit tests make the edge cases clear.

@function
@name module:bbop-core#first_split
@param {String} character - the character to split on
@param {String} string - the string to split
@returns {Array} list of first and second parts
Attempt to return a two part split on the first occurrence of a character .