function occurrencesOf (obj, what) {
                    if(arguments.length < 2) return 0;

                    if(typeof obj === 'boolean') {
                        return 0;
                    }
                    if(typeof obj === 'number') {
                        return occurrencesOf(obj.toString(), what);
                    }
                    else if(typeof obj === 'function') {
                        return occurrencesOf(fixFirefoxFunctionString(obj.toString()), what);
                    }

                    var count = 0;
                    if(typeof obj === 'string') {
                        if(typeof what === 'string' || typeof what === 'number') {
                            var regexp = new RegExp(what.toString(), 'g'), m;
                            while(m = regexp.exec(obj)) count++; // jshint ignore:line
                        }
                    }
                    else if(typeof obj !== 'string') {
                        libs.object.every(obj, function (item) {
                            if(item === what) count++;
                        });
                    }
                    return count;
                }
function occurrencesOf (obj, what) {
                    if(arguments.length < 2) return 0;

                    if(typeof obj === 'boolean') {
                        return 0;
                    }
                    if(typeof obj === 'number') {
                        return occurrencesOf(obj.toString(), what);
                    }
                    else if(typeof obj === 'function') {
                        return occurrencesOf(fixFirefoxFunctionString(obj.toString()), what);
                    }

                    var count = 0;
                    if(typeof obj === 'string') {
                        if(typeof what === 'string' || typeof what === 'number') {
                            var regexp = new RegExp(what.toString(), 'g'), m;
                            while(m = regexp.exec(obj)) count++; 
                        }
                    }
                    else if(typeof obj !== 'string') {
                        libs.object.every(obj, function (item) {
                            if(item === what) count++;
                        });
                    }
                    return count;
                }
function occurrencesOf ( obj , what ) { if ( arguments . length < 2 ) return 0 ; if ( typeof obj === 'boolean' ) { return 0 ; } if ( typeof obj === 'number' ) { return occurrencesOf ( obj . toString ( ) , what ) ; } else if ( typeof obj === 'function' ) { return occurrencesOf ( fixFirefoxFunctionString ( obj . toString ( ) ) , what ) ; } var count = 0 ; if ( typeof obj === 'string' ) { if ( typeof what === 'string' || typeof what === 'number' ) { var regexp = new RegExp ( what . toString ( ) , 'g' ) , m ; while ( m = regexp . exec ( obj ) ) count ++ ; // jshint ignore:line } } else if ( typeof obj !== 'string' ) { libs . object . every ( obj , function ( item ) { if ( item === what ) count ++ ; } ) ; } return count ; }
Returns the number of occurences of "what"
@param {*} obj The item to count the occurences of "what" in.
@param {*} what The item to count the occurences of the item in the array.
@return {[type]} [description]
Returns the number of occurences of what