Global

Members

errors

Predefined List of Errors to manipulate them all at one place.
Source:

reservedFieldNames

The following are reserved fields and filters that serve as 'keywords' and must not be used inside a row of a table in the database. The reservedFilters are filters that the user can use for querying, refer to the querying docs for a guide on that.
Source:

unserialize

File ops coming soon.
Source:

Methods

createDatabase(dbName) → {undefined}

Creates a new database with dbName. Doesn't allow overwriting the previously existing one.
Parameters:
Name Type Description
dbName string The name of the database.
Source:
Returns:
Type
undefined

generateUniqueId() → {Number}

Generates a unique id to be used in fields such as 'entryId'.
Source:
Returns:
A sufficiently random number that can be used as a unique Id.
Type
Number

getDatabase(dbName) → {string}

Gets the database with dbName.
Parameters:
Name Type Description
dbName string The name of the database.
Source:
Returns:
The serialized/stringified database data in localStorage.
Type
string

getNestedField(row, fieldToGet) → {any}

Function to get nested fields from objects, using strings like: 'parentField.childField'.
Parameters:
Name Type Description
row Object The object representing a row in a database table.
fieldToGet String The string representation of the field to get from the database.
Source:
Returns:
Type
any

rowMatchesFilters(row, filters) → {Boolean}

Checks whether a table row matches filters or not.
Parameters:
Name Type Description
row Object The row to validate.
filters Object The filters to validate against.
Source:
Returns:
Type
Boolean

validateValueAgainstFilter(filterValue, value) → {Boolean}

Function to validate value against a regex or just plain value.
Parameters:
Name Type Description
filterValue any The value of the filter to validate against.
value any The value to check for equality.
Source:
Returns:
Type
Boolean

verifyByCustomOperation(row, field, valueToValidateOn) → {Boolean}

Function to check if a row in a table matches a specified operation or not. (Operations such as in, not, not-in, includes, not includes etc).
Parameters:
Name Type Description
row Object The object representing a row in a database table.
field field Name of field to verify operation on.
valueToValidateOn * The value to compare with, type depends on the operation.
Source:
Returns:
Type
Boolean

verifyOrOperation(row, subFilters) → {Boolean}

Function to check if a row in a table matches any one of the specified operations or not. I.E: "Or" Operations.
Parameters:
Name Type Description
row Object The object representing a row in a database table.
subFilters Array The filters to check the row against.
Source:
Returns:
Type
Boolean

writeDatabase(dbName, databaseObject) → {undefined}

Serializes an object and writes it to a database in localStorage.
Parameters:
Name Type Description
dbName string The name of the database to write to.
databaseObject object The object to serialize and write.
Source:
Returns:
Type
undefined