MCPcopy Create free account
hub / github.com/codecombat/codecombat / initialize

Method initialize

app/views/common/SearchView.js:20–33  ·  view source on GitHub ↗
(modelURL, model, term, projection, limit, options = {})

Source from the content-addressed store, hash-verified

18
19class SearchCollection extends Backbone.Collection {
20 initialize (modelURL, model, term, projection, limit, options = {}) {
21 this.model = model
22 this.term = term
23 this.projection = projection
24 this.limit = limit
25 this.url = `${modelURL}?project=`
26 if (this.projection != null ? this.projection.length : undefined) {
27 this.url += 'created,permissions'
28 for (const projected of Array.from(this.projection)) { this.url += ',' + projected }
29 } else { this.url += 'true' }
30 if (this.term) { this.url += `&term=${this.term}` }
31 if (this.limit !== 100) { this.url += `&limit=${this.limit}` }
32 if (options?.queryParams) { this.url += `&${options.queryParams}` }
33 }
34
35 comparator (a, b) {
36 let score = 0

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected