Skip to content

Commit

Permalink
Allow custom Suggestion objects
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Hoffman <[email protected]>
  • Loading branch information
ValenciaMgmt authored and Fustrate committed Mar 5, 2019
1 parent e948379 commit c44fc92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion awesomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var _ = function (input, o) {
container: _.CONTAINER,
item: _.ITEM,
replace: _.REPLACE,
suggestion: Suggestion,
tabSelect: false
}, o);

Expand Down Expand Up @@ -305,7 +306,7 @@ _.prototype = {

this.suggestions = this._list
.map(function(item) {
return new Suggestion(me.data(item, value));
return new me.suggestion(me.data(item, value));
})
.filter(function(item) {
return me.filter(item, value);
Expand Down
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ <h1>Extend</h1>
</td>
<td><code class="language-javascript">Awesomplete.DATA</code>: Identity function which just returns the original list item.</td>
</tr>
<tr>
<td><code>suggestion</code></td>
<td>Controls the class used to create new Suggestions.</td>
<td>A class that responds to the <code>label</code>, <code>value</code>, and <code>length</code> properties and the <code>toString</code> and <code>valueOf</code> methods.</td>
<td><code>Suggestion</code>: A basic class, protoyped from <code>String</code>, which provides the requisite functionality.</td>
</tr>
</tbody>
</table>
</section>
Expand Down

0 comments on commit c44fc92

Please sign in to comment.