search-light

SearchLight

Source:

Classes

SearchLight

Methods

(static) search(collection) → {SearchLight}

Source:
Example
search(['one', 'two', 'three'])
Parameters:
Name Type Description
collection Collection

Array or object of items or properties to search

Returns:

instance - new SearchLight instance

Type
SearchLight

Type Definitions

Collection

Source:
Type:
  • Array | Object

Match

Source:
Properties:
Name Type Description
0 *

key

1 number

relevance

2 string

missing terms

Type:
  • Array

Matches

Source:
Type:
  • Array.<Match>

FilterObject

Source:
Properties:
Name Type Attributes Default Description
key *

the property the filter applies to

operator string <optional>
'=='

the comparison operator to use

value *

the value to check the items against

Type:
  • Object

FilterArray

Source:
Properties:
Name Type Attributes Description
0 *

the property the filter applies to

1 *

the comparison operator to use

2 * <optional>

the value to check the items against if only two elements, the second one is assumed to be the value and the operator is set to '=='

Type:
  • Array

Constraint

Source:
Type:
  • string | FilterArray | FilterObject

NextIterator

Source:
Properties:
Name Type Description
next function

iterator function to use

Type:
  • Object

SuccessCallback(results)

Source:
Parameters:
Name Type Description
results Object

FailureCallback(error)

Source:
Parameters:
Name Type Description
error Error

SortCallback(getItem, matchA, matchB)

Source:
Parameters:
Name Type Description
getItem function
matchA Match
matchB Match