core/asset/js/plugin/dist/gina.min.js
function collectionFind(filter, options) {
        if (!filter) {
            // TODO - limit of ten by
            return collections[ this['_collection'] ]
        }

        if ( typeof(filter) !== 'object' ) { // == findAll
            throw new Error('filter must be an object');
        } else {
            //console.log('search into ', this['_collection'], collections[ this['_collection'] ], collections);
            var content             = collections[ this['_collection'] ]
                , condition         = filter.count()
                , i                 = 0
                , found             = []
                , localeLowerCase   = '';

            for (var o in content) {
                for (var f in filter) {
                    localeLowerCase = ( typeof(filter[f]) != 'boolean' ) ? filter[f].toLocaleLowerCase() : filter[f];
                    if ( filter[f] && keywords.indexOf(localeLowerCase) > -1 && localeLowerCase == 'not null' && typeof(content[o][f]) != 'undefined' && typeof(content[o][f]) !== 'object' && content[o][f] != 'null' && content[o][f] != 'undefined' ) {
                        if (found.indexOf(content[o][f]) < 0 ) {
                            found[i] = content[o][f];
                            ++i
                        }

                    } else if ( typeof(content[o][f]) != 'undefined' && typeof(content[o][f]) !== 'object' && content[o][f] === filter[f] ) {
                        found[i] = content[o];
                        ++i
                    }
                }
            }
        }

        return found
    }
function collectionFind(filter, options) {
        if (!filter) {
            // TODO - limit of ten by
            return collections[ this['_collection'] ]
        }

        if ( typeof(filter) !== 'object' ) { // == findAll
            throw new Error('filter must be an object');
        } else {
            //console.log('search into ', this['_collection'], collections[ this['_collection'] ], collections);
            var content             = collections[ this['_collection'] ]
                , condition         = filter.count()
                , i                 = 0
                , found             = []
                , localeLowerCase   = '';

            for (var o in content) {
                for (var f in filter) {
                    localeLowerCase = ( typeof(filter[f]) != 'boolean' ) ? filter[f].toLocaleLowerCase() : filter[f];
                    if ( filter[f] && keywords.indexOf(localeLowerCase) > -1 && localeLowerCase == 'not null' && typeof(content[o][f]) != 'undefined' && typeof(content[o][f]) !== 'object' && content[o][f] != 'null' && content[o][f] != 'undefined' ) {
                        if (found.indexOf(content[o][f]) < 0 ) {
                            found[i] = content[o][f];
                            ++i
                        }

                    } else if ( typeof(content[o][f]) != 'undefined' && typeof(content[o][f]) !== 'object' && content[o][f] === filter[f] ) {
                        found[i] = content[o];
                        ++i
                    }
                }
            }
        }

        return found
    }
function collectionFind ( filter , options ) { if ( ! filter ) { // TODO - limit of ten by return collections [ this [ '_collection' ] ] } if ( typeof ( filter ) !== 'object' ) { // == findAll throw new Error ( 'filter must be an object' ) ; } else { //console.log('search into ', this['_collection'], collections[ this['_collection'] ], collections); var content = collections [ this [ '_collection' ] ] , condition = filter . count ( ) , i = 0 , found = [ ] , localeLowerCase = '' ; for ( var o in content ) { for ( var f in filter ) { localeLowerCase = ( typeof ( filter [ f ] ) != 'boolean' ) ? filter [ f ] . toLocaleLowerCase ( ) : filter [ f ] ; if ( filter [ f ] && keywords . indexOf ( localeLowerCase ) > - 1 && localeLowerCase == 'not null' && typeof ( content [ o ] [ f ] ) != 'undefined' && typeof ( content [ o ] [ f ] ) !== 'object' && content [ o ] [ f ] != 'null' && content [ o ] [ f ] != 'undefined' ) { if ( found . indexOf ( content [ o ] [ f ] ) < 0 ) { found [ i ] = content [ o ] [ f ] ; ++ i } } else if ( typeof ( content [ o ] [ f ] ) != 'undefined' && typeof ( content [ o ] [ f ] ) !== 'object' && content [ o ] [ f ] === filter [ f ] ) { found [ i ] = content [ o ] ; ++ i } } } } return found }
Find from collection

// TODO - add options

@param {object} filter
@param {object} [options] - e.g.: limit

@return {array} result
Find from collection