Class: Query

FooTable. Query

new Query(query, space, connectors, ignoreCase) → {FooTable.Query}

The query object is used to parse and test the filtering component's queries
Parameters:
Name Type Argument Default Description
query string The string value of the query.
space string <optional>
"AND" How the query treats whitespace.
connectors boolean <optional>
true Whether or not to replace phrase connectors (+.-_) with spaces.
ignoreCase boolean <optional>
true Whether or not ignore case when matching.
Returns:
Type
FooTable.Query

Extends

Members

<private> _original :string

Holds the previous value of the query and is used internally in the FooTable.Query#val method.
Type:
  • string

<private> _value :string

Holds the value for the query. Access to this variable is provided through the FooTable.Query#val method.
Type:
  • string

connectors :boolean

Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
Type:
  • boolean

ignoreCase :boolean

Whether or not ignore case when matching.
Type:
  • boolean

left :FooTable.Query

The left side of the query if one exists. OR takes precedence over AND.
Type:
Example

The below shows what is meant by the "left" side of a query

query = "Dave AND Mary" - "Dave" is the left side of the query.
query = "Dave AND Mary OR John" - "Dave and Mary" is the left side of the query.

operator :string

The type of operand to apply to the results of the individual parts of the query.
Type:
  • string

parts :Array

The parsed parts of the query. This contains the information used to actually perform a match against a string.
Type:
  • Array
The right side of the query if one exists. OR takes precedence over AND.
Type:
Example

The below shows what is meant by the "right" side of a query

query = "Dave AND Mary" - "Mary" is the right side of the query.
query = "Dave AND Mary OR John" - "John" is the right side of the query.

space :string

A string specifying how the query treats whitespace. Can be either "OR" or "AND".
Type:
  • string

Methods

<private, static> _left(str, def) → {boolean}

Matches the left side of the query if one exists with the supplied string.
Parameters:
Name Type Description
str string The string to test.
def boolean The default value to return based on the operand.
Returns:
Type
boolean

<private, static> _match(str, def) → {boolean}

Matches this queries parts array against the supplied string.
Parameters:
Name Type Description
str string The string to test.
def boolean The default value to return based on the operand.
Returns:
Type
boolean

<private, static> _parse()

Parses the private FooTable.Query#_value property and populates the object.

<private, static> _part(str) → {Object}

Parses a single part of a query into an object to use during matching.
Parameters:
Name Type Description
str string The string representation of the part.
Returns:
Type
Object

<private, static> _right(str, def) → {boolean}

Matches the right side of the query if one exists with the supplied string.
Parameters:
Name Type Description
str string The string to test.
def boolean The default value to return based on the operand.
Returns:
Type
boolean

<static> match(str) → {boolean}

Tests the supplied string against the query.
Parameters:
Name Type Description
str string The string to test.
Returns:
Type
boolean

<static> val(value) → {string|undefined}

Gets or sets the value for the query. During set the value is parsed setting all properties as required.
Parameters:
Name Type Argument Description
value string <optional>
If supplied the value to set for this query.
Returns:
Type
string | undefined
Copyright © 2016
Documentation generated by JSDoc 3.4.1 on 2017-07-06T21:37:43+02:00