index.js
function(data, pattern) {
    var result  = {}
    // iterate thorough data
    for (var i in data) {
        // create context data
        var _data = data[i]

        // if key match with pattern
        if (i.match(pattern)) {
            // add matched data
            result[i] = _data
        }

        // if value match with pattern
        if (_data.toString().match(pattern)) {
            result[i] = _data
        }
    }
    // result
    return result
}
function(data, pattern) {
    var result  = {}
    // iterate thorough data
    for (var i in data) {
        // create context data
        var _data = data[i]

        // if key match with pattern
        if (i.match(pattern)) {
            // add matched data
            result[i] = _data
        }

        // if value match with pattern
        if (_data.toString().match(pattern)) {
            result[i] = _data
        }
    }
    // result
    return result
}
function ( data , pattern ) { var result = { } // iterate thorough data for ( var i in data ) { // create context data var _data = data [ i ] // if key match with pattern if ( i . match ( pattern ) ) { // add matched data result [ i ] = _data } // if value match with pattern if ( _data . toString ( ) . match ( pattern ) ) { result [ i ] = _data } } // result return result }
matchPattern find pattern in data
matchPattern find pattern in data