Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/therebelrobot/backbone-deep-model-collection-search

A small monkeypatch for backbone collections to make it work with backbone-deep-model
https://github.com/therebelrobot/backbone-deep-model-collection-search

Last synced: 24 days ago
JSON representation

A small monkeypatch for backbone collections to make it work with backbone-deep-model

Awesome Lists containing this project

README

        

# backbone-deep-model-collection-search
A small sideloader for backbone collections to make it work with [backbone-deep-model](https://github.com/kahwee/backbone-deep-model)

### Installation

```
npm install --save backbone-deep-model-collection-search
```

### Usage

```
var BackboneCollection = require('backbone-deep-model-collection-search')(Backbone.Collection)

// Build your own collection from this

var List = BackboneCollection.extend({ ... })

var thisNewList = new List()

thisNewList.deepSearch({'dot.delimited.search.term':true})

// returns array of results, so for no matches [], for 2 matches [model, model]
```

### Why

This stemmed out of my need to deep search collections that contain deep-linked models, as described [in this issue](https://github.com/kahwee/backbone-deep-model/issues/40).

### License
ISC