Code coverage report for string/removeNonWord.js

Statements: 100% (5 / 5)      Branches: 50% (1 / 2)      Functions: 100% (3 / 3)      Lines: 100% (4 / 4)     

All files » string/ » removeNonWord.js
1 2 3 4 5 6 7 8 9 10 11 12 13 141               1 30   1    
define(function(){
    /**
     * Remove non-word chars.
     * @example removeNonWord('lorem! ipsum?') -> 'lorem ipsum'
     * @param {string} str
     * @return {string}
     * @version 0.1.0 (2011/07/20)
     */
    function removeNonWord(str){
        return (str || '').replace(/[^0-9a-zA-Z\xC0-\xFF \-]/g, ''); //remove non-word chars
    }
    return removeNonWord;
});