Class: Stork

Stork

new Stork(options, success, failure)

Creates a Stork instance.

new Stork(); // global key-values/records
new Stork({name: 'todos'}); // grouped key-values/records
new Stork({name: 'rooms', key: 'ID'}); // records have 'ID' property which is used as key for saving records
new Stork({name: 'you are', lazy: true}); // records aren't all loaded on start, they are loaded as needed
new Stork({name: 'users', database: 'myapp', size: 65536}); // some storage engines support a custom database name and a desired size for the database

new Stork(options, function(stork) {
  // stork = initialized stork instance
});
Name Type Description
options Object optional

An object of options, see the following properties for more details: Stork#key, Stork#name, Stork#lazy.

success Stork~initSuccess optional

The function to invoke when the instance successfully initializes.

failure Stork~initFailure optional

The function to invoke if this instance failes to initialize.

Classes

FastMap
Promise

Members

staticStork.adaptersArray

An array of adapters available for implementing a Stork instance. Each item in the array is an object with three properties: String name, Number priority, and Object definition.

See:

staticStork.pluginsArray

An array of all plugin functions invoked on a Stork instance when it's created.

See:

adapterObject

The adapter Object with String name, Number priority, and Object definition properties. The adapter can be chosen based on the options.adapter and falls back to the next supported adapter based on priority.

cacheFastMap

The cache of key-value pairs currently loaded. If Stork#loaded is true then all key-value pairs exist in the cache.

initializedBoolean

True if this instance has successfully initialized, otherwise false if it failed to initialize or has not finished initializing.

keyString

The name of the property to use as the key for the Stork#save and Stork#batch functions. This should be specified in the options object.

Default Value:
  • 'id'

lazyBoolean

If true, key-value pairs will be lazily loaded instead of loaded all at once on initialization. This should be specified in the options object.

Default Value:
  • false

loadedBoolean

True if the entire instance has been loaded into the Stork#cache, otherwise false. If lazy is specifed as true loaded will be false until any of the following methods are invoked: Stork#each, Stork#all, or Stork#reload.

nameString

The name used to group the key-value pairs. This is essentially a table name. This should be specified in the options object.

Default Value:
  • ''

optionsObject

The options passed to the constructor and subsequently to the Stork#init function.

Default Value:
  • {}

pendingArray.<Object>

An array of functions called by the user before this instances was finished initializing. Once this instance successfully finishes initialization all pending functions are invoked in the order in which they were originally made and this property is set to null.

Methods

staticStork.adapter(name, priority, definition){Stork}

Adds an adapter available for Stork to use if it's supported.

Example

Stork.adapter('myadapter', 7, {
  valid: function() { ... },
  init: function(options, success, failure) { ... },
  reload: function(success, failure) { ... },
  _get: function(key, rawKey, promise) { ... },
  _destroy: function(promise) { ... },
  _put: function(key, value, rawKey, rawValue, promise) { ... },
  _remove: function(key, rawKey, value, promise) { ... },
  _size: function(promise) { ... }
});
Name Type Description
name String

The name of the adapter. Must be unique.

priority Number

The priority of this adapter. The higher the value the earlier it's checked for support and is used by Stork instances.

definition function | Object

The definition of the adapter which is either an object of methods to overwrite for the Stork instance, or a function which returns a similar object.

Returns:
class="prettyprint source"> The Stork namespace.

staticStork.plugin(definition){Stork}

Adds a plugin function to be invoked on every Stork instance that's created. Each plugin function is invoked after an adapter is chosen and integrated, but before the Stork#init function is called.

Example

Stork.plugin(function(stork) {
  var oldPut = stork.put;
  stork.put = function(key, value, success, failure) {
    // before put
    var promise = oldPut.apply( this, arguments );
    // after put, listen to promise?
    return promise;
  };
});
Name Type Description
definition Stork~plugin

The function invoked on every Stork instance.

Returns:
The Stork namespace.

aggregate(property, accumulate, getResult, success, failure){Stork.Promise}

Performs an aggregation on key-value pairs where the value is an Object which may have a specific property to aggregate. The result of the aggregation is returned to the callback.

This is part of the aggregation plugin.

Name Type Description
property String

The property on the object to pass to the accumulation function.

accumulate Stork~aggregateAccumulate

The function to invoke with the value of the property.

getResult Stork~aggregateResult

The function to call at the end to returned the aggregated value.

success Stork~aggregateSuccess optional

The function to invoke when a value is successfully aggregated.

failure Stork~aggregateSuccess optional

The function to invoke if there's a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

all(success, failure){Stork.Promise}

Returns all key-value pairs to the success callback.

Usage

var onSuccessFunc = function(values, keys) {
  // handle success
};
var onFailureFunc = function(error) {
  // uh oh!
};
db.all( onSucessFunc, onFailureFunc ); // listen for success/failure
db.all().then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
success Stork~allSuccess optional

The function to invoke with all the key-value pairs.

failure Stork~allFailure optional

The function to invoke if this Stork was unable to return all of the key-value pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

avg(property, success, failure){Stork.Promise}

Returns the average of a set of values taken from a property on all Object values to the callback.

This is part of the aggregation plugin.

Usage

db.avg('age', function(avg) {
  // avg = the average age
});
Name Type Description
property String

The property on the object to average.

success Stork~aggregateSuccess optional

The function to invoke with the average.

failure Stork~aggregateSuccess optional

The function to invoke if there's a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

batch(records, success, failure){Stork.Promise}

Saves an array of Object records and returns the records saved to the callback. The record is the value in the key-value pair and the key is pulled from the record based on the options passed into the Stork#init function. The property used as the key is this.key and by default is id. If a key isn't specified in a record then a UUID is used and placed in the object.

Usage

var onSuccessFunc = function(records) {
  // handle success
};
var onFailureFunc = function(records, recordsSaved, error) {
  // uh oh!
};
db.batch( records ); // I don't care about whether it succeeds or fails
db.batch( records, onSucessFunc, onFailureFunc ); // listen for success/failure
db.batch( records ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
records Array

The array of objects to save.

success Stork~batchSuccess optional

The function to invoke when all records are successfully saved.

failure Stork~batchFailure optional

The function to invoke if any of the records failed to save.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

count(property, success, failure){Stork.Promise}

Returns the number of values that are objects and have the specified property to the callback.

This is part of the aggregation plugin.

Usage

db.count('name', function(count) {
  // count = the number of objects with the property 'name'
});
Name Type Description
property String

The property on the object to look for.

success Stork~aggregateSuccess optional

The function to invoke with the number of values with the property.

failure Stork~aggregateSuccess optional

The function to invoke if there's a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

destroy(success, failure){Stork.Promise}

Removes all key-value pairs and invokes the callback.

Usage

var onSuccessFunc = function() {
  // DESTROYED!
};
var onFailureFunc = function(error) {
  // uh oh!
};
db.destroy(); // I don't care about whether it succeeds or fails
db.destroy( onSucessFunc, onFailureFunc ); // listen for success/failure
db.destroy().then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
success Stork~destroySuccess optional

The function invoked when all key-value pairs are removed.

failure Stork~destroyFailure optional

The function invoked if there was a problem removing all key-value pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

each(callback, failure){Stork}

Returns every key-value pair individually to the given callback.

Usage

var onPairFunc = function(value, key) {
  // handle success
};
var onFailureFunc = function(error) {
  // uh oh!
};
db.each( onPairFunc ); // I don't care about whether it fails
db.each( onPairFunc, onFailureFunc ); // listen for success & failure
Name Type Description
callback Stork~eachSuccess

The function to invoke for each key-value pair.

failure Stork~eachFailure optional

The function to invoke if there was a problem iterating the key-value pairs.

Returns:
The reference to this Stork instance.

get(key, success, failure){Stork.Promise}

Gets the value for the given key and returns it to the callback. If the key doesn't exist then undefined is given to the callback.

Usage

var onSuccessFunc = function(value, key) {
  // handle success
};
var onFailureFunc = function(key, error) {
  // uh oh!
};
db.get( key, onSucessFunc, onFailureFunc ); // listen for success/failure
db.get( key ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
key Any

The key of the key-value pair to get.

success Stork~getSuccess optional

The function to invoke if a value is successfully found or not found.

failure Stork~getFailure optional

The function to invoke if there was a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

getMany(keys, success, failure){Stork.Promise}

Gets an array of values given an array of keys and returns it to the callback. If the key doesn't exist then the corresponding value in the returned array will be undefined.

Usage

var onSuccessFunc = function(values, keys) {
  // handle success
};
var onFailureFunc = function(keys, error) {
  // uh oh!
};
db.getMany( arrayOfKeys, onSucessFunc, onFailureFunc ); // listen for success/failure
db.getMany( arrayOfKeys ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
keys Array

The keys of the key-value pairs to get.

success Stork~getManySuccess optional

THe function to invoke with the values found.

failure Stork~getManyFailure optional

The function to invoke if there was a problem getting values.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

init(options, success, failure){Stork.Promise}

Initializes this Stork instance. If options.lazy is passed in as true, key-value pairs will not be loaded here, otherwise all key-value pairs will be loaded. This function is automatically called at the end of the Stork constructor with the options passed to the constructor.

Name Type Description
options Object

The initialization options.

success Stork~initSuccess optional

The function to invoke when the Stork instance successfully initializes and is usable.

failure Stork~initFailure optional

The function to invoke if there's a problem initializing.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

max(property, success, failure){Stork.Promise}

Returns the maximum value of a set of values taken from a property on all Object values to the callback.

This is part of the aggregation plugin.

Usage

db.max('age', function(max) {
  // max = the maximum age
});
Name Type Description
property String

The property on the object to find the maximum value of.

success Stork~aggregateSuccess optional

The function to invoke with the maximum value.

failure Stork~aggregateSuccess optional

The function to invoke if there's a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

min(property, success, failure){Stork.Promise}

Returns the minimum value of a set of values taken from a property on all Object values to the callback.

This is part of the aggregation plugin.

Usage

db.min('age', function(min) {
  // min = the minimum age
});
Name Type Description
property String

The property on the object to find the minimum value of.

success Stork~aggregateSuccess optional

The function to invoke with the minimum value.

failure Stork~aggregateSuccess optional

The function to invoke if there's a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

put(key, value, success, failure){Stork.Promise}

Adds or updates the value mapped by the given key and returns the key and value placed to the callback.

Usage

var onSuccessFunc = function(key, value, previousValue) {
  // handle success
};
var onFailureFunc = function(key, value, error) {
  // uh oh!
};
db.put( key, value ); // I don't care about whether it succeeds or fails
db.put( key, value, onSucessFunc, onFailureFunc ); // listen for success/failure
db.put( key, value ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
key Any

The key to add or update.

value Any

The value to add or update.

success Stork~putSuccess optional

The function to invoke when the key-value pair is successfully added or updated.

failure Stork~putFailure optional

The function to invoke if there was a problem putting the key-value pair.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

reload(success, failure){Stork.Promise}

Loads all key-value pairs into the cache which will increase performance for fetching operations (Stork#get, Stork#getMany, Stork#each, Stork#all).

Usage

var onSuccessFunc = function(values, keys) {
  // handle success
};
var onFailureFunc = function(error) {
  // uh oh!
};
db.reload(); // I don't care about whether it succeeds or fails
db.reload( onSucessFunc, onFailureFunc ); // listen for success/failure
db.reload().then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
success Stork~reloadSuccess optional

The function to invoke when all key-value pairs are loaded.

failure Stork~reloadFailure optional

The function to invoke if there was a problem loading all key-value pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

remove(key, success, failure){Stork.Promise}

Removes the key-value pair for the given key and returns the removed value to the callback if on existed.

Usage

var onSuccessFunc = function(value, key) {
  // handle success
};
var onFailureFunc = function(key, error) {
  // uh oh!
};
db.remove( key ); // I don't care about whether it succeeds or fails
db.remove( key, onSucessFunc, onFailureFunc ); // listen for success/failure
db.remove( key ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
key Any

The key of the key-value pair to remove.

success Stork~removeSuccess optional

The function to invoke then the key is removed or doesn't exist.

failure Stork~removeFailure optional

The function to invoke if there was a problem removing the key.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

removeMany(keys, success, failure){Stork.Promise}

Removes multiple key-value pairs and returns the values removed to the given callback.

Usage

var onSuccessFunc = function(values, keys) {
  // handle success
};
var onFailureFunc = function(values, removed, error) {
  // uh oh!
};
db.removeMany( keys ); // I don't care about whether it succeeds or fails
db.removeMany( keys, onSucessFunc, onFailureFunc ); // listen for success/failure
db.removeMany( keys ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
keys Array

The array of keys to remove.

success Stork~removeManySuccess optional

The function to invoke once all matching key-value pairs are removed, with the values removed.

failure Stork~removeManyFailure optional

The function to invoke if there was a problem removing any of the key-value pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

save(record, success, failure){Stork.Promise}

Saves an Object record and returns the saved record to the callback. The record is the value in the key-value pair and the key is pulled from the record based on the options passed into the Stork#init function. The property used as the key is this.key and by default is id. If a key isn't specified in a record then a UUID is used and placed in the object.

Usage

var onSuccessFunc = function(record) {
  // handle success
};
var onFailureFunc = function(record, error) {
  // uh oh!
};
db.save( record ); // I don't care about whether it succeeds or fails
db.save( record, onSucessFunc, onFailureFunc ); // listen for success/failure
db.save( record ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
record Object

The record to save.

success Stork~saveSuccess optional

The function to invoke when the record is successfully saved.

failure Stork~saveFailure optional

The function to invoke if the record fails to save.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

select(columns, success, failure){Stork.Promise}

Returns column values (if columns is a string) or an array of objects of column values (if columns is an array) to the callback.

This is part of the query plugin.

Usage

var onSuccessFunc = function(values, keys) {
  // handle success
};
var onFailureFunc = function(columns, error) {
  // uh oh!
};
db.select( 'name', onSucessFunc, onFailureFunc ); // listen for success/failure
db.select( ['name', 'id'] ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
columns String | Array

The property you want to return or an array of properties to return.

success Stork~selectSuccess optional

The function to invoke with the selected properties.

failure Stork~selectFailure optional

The function to invoke if there was a problem selecting the columns.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

size(success, failure){Stork.Promise}

Returns the number of key-value pairs to the success callback.

Usage

var onSuccessFunc = function(count) {
  // handle success
};
var onFailureFunc = function(error) {
  // uh oh!
};
db.size( onSucessFunc, onFailureFunc ); // listen for success/failure
db.size().then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
success Stork~sizeSuccess optional

The function to invoke with the number of key-value pairs.

failure Stork~sizeFailure optional

The function to invoke if there was a problem determining the number of key-value pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

sort(comparator, desc, success, failure){Stork.Promise}

Sorts all key-value pairs and returns them to the callback. Next time the key-value pairs are iterated over they will be returned in the same order. The underlying structure should be considered unsorted anytime key-value pairs are updated, added, or removed.

This is part of the query plugin.

Usage

var compareFunc = function(a, b) {
  // compare a & b and return a number
};
var onSuccessFunc = function(values, keys) {
  // handle success
};
var onFailureFunc = function(error) {
  // uh oh!
};
db.sort( compareFunc, false, onSucessFunc, onFailureFunc ); // listen for success/failure
db.sort( compareFunc ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
comparator Stork~sortComparator

The function used to compare two values.

desc Boolean

If the key-value pairs should be in descending (reversed) order.

success Stork~sortSuccess optional

The function to invoke with the sorted values & keys.

failure Stork~sortFailure optional

The function to invoke if there was a problem sorting the pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

sum(property, success, failure){Stork.Promise}

Returns the sum of a set of values taken from a property on all Object values to the callback.

This is part of the aggregation plugin.

Usage

db.sum('kills', function(sum) {
  // sum = total of all kills
});
Name Type Description
property String

The property on the object to sum.

success Stork~aggregateSuccess optional

The function to invoke with the sum.

failure Stork~aggregateSuccess optional

The function to invoke if there's a problem.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

A helper method for creating a consistent look when chaining promised functions.

Usage

db.then(function() { // <--
    // this === db, how big is it?
    return this.size();
  })
  .then(function(size) {
    // size has been determined, destroy!
    return this.destroy();
  })
  .then(function(){
    // You sunk my battleship! (destroyed db)
  })
;
Name Type Description
callback function

The callback to invoke with this Stork instance as this.

Returns:
The callback should return a Promise to chain additional functions.

valid(){Boolean}

Determines whether this Stork implementation is available.

Returns:
if this Stork is usable, otherwise false.

where(condition, success, failure){Stork.Promise}

Returns a subset of key-value pairs that match a condition function to the callback.

This is part of the query plugin.

Usage

var condition = function(value, key) {
  // return true if key-value matches some condition
};
var onSuccessFunc = function(value, key) {
  // handle success
};
var onFailureFunc = function(key, error) {
  // uh oh!
};
db.where( condition, onSucessFunc, onFailureFunc ); // listen for success/failure
db.where( condition ).then( onSuccessFunc, onFailureFunc ); // listen to promise
Name Type Description
condition Stork~where

The function to invoke on each key-value pair to determine whether that pair is included in the results.

success Stork~whereSuccess optional

The function to invoke with the matched key-value pairs.

failure Stork~whereFailure optional

The function to invoke if there was a problem retrieving the key-value pairs.

Returns:
The promise that can be used to listen for success or failure, as well as chaining additional calls.

Type Definitions

aggregateAccumulate(value)

The format of an accumulation callback for aggregation functions.

Name Type Description
value Any

The value to process for accumulation.

aggregateFailure(error)

The format of failure callback for aggregation functions.

Name Type Description
error Any

The error that was thrown.

aggregateResult(){Any}

The format of an accumulation callback for aggregation functions.

Returns:
result of the accumulated values.

aggregateSuccess(aggregatedValue)

The format of success callback for aggregation functions.

Name Type Description
aggregatedValue Number

The result of the aggregation function.

allFailure(error)

The format of failure callback for Stork#all.

Name Type Description
error Any

The error that was thrown.

allSuccess(values, keys)

The format of success callback for Stork#all.

Name Type Description
values Array

An array of all values stored. This should not be modified.

keys Array

An array of all keys stored. This should not be modified.

batchFailure(records, recordsSaved, error)

The format of failure callback for Stork#batch.

Name Type Description
records Array

The records unsuccessfully saved.

recordsSaved Number

The number of records that successfully saved.

error Any

The error that was thrown.

batchSuccess(records)

The format of success callback for Stork#batch.

Name Type Description
records Array

The records successfully saved.

destroyFailure(error)

The format of failure callback for Stork#destroy.

Name Type Description
error Any

The error that was thrown.

destroySuccess()

The format of success callback for Stork#destroy.

eachFailure(error)

The format of failure callback for Stork#each.

Name Type Description
error Any

The error that was thrown.

eachSuccess(value, key)

The format of success callback for Stork#each.

Name Type Description
value Any

The value of the current key-value pair.

key Any

The key of the current key-value pair.

getFailure(key, error)

The format of failure callback for Stork#get.

Name Type Description
key Any

The key of the key-value pair that was unsuccessfully gotten.

error Any

The error that was thrown.

getManyFailure(keys, error)

The format of failure callback for Stork#getMany.

Name Type Description
keys Array

The keys given that resulted in an error.

error Any

The error that was thrown.

getManySuccess(values)

The format of success callback for Stork#getMany.

Name Type Description
values Array

The array of values associated to the given keys. If a key wasn't found then the value in the array will be undefined.

getSuccess(value, key)

The format of success callback for Stork#get.

Name Type Description
value Any

The value associated to the given key or undefined if one was not found.

key Any

The key of the key-value pair that was successfully found.

initFailure(error)

The format of failure callback for Stork#init.

Name Type Description
error Any

The error that was thrown.

initSuccess(stork)

The format of success callback for Stork#init.

Name Type Description
stork Stork

The reference to this Stork instance.

plugin(stork)

Name Type Description
stork Stork

The Stork instance to run the plugin on.

putFailure(key, value, error)

The format of failure callback for Stork#put.

Name Type Description
key Any

The key that failed to be added or updated.

value Any

The value that failed to be added or updated.

error Any

The error that was thrown.

putSuccess(key, value, previousValue)

The format of success callback for Stork#put.

Name Type Description
key Any

The key to add or update.

value Any

The value to add or update.

previousValue Any

The previous value for the key if it exists in the cache.

reloadFailure(error)

The format of failure callback for Stork#reload.

Name Type Description
error Any

The error that was thrown.

reloadSuccess(values, keys)

The format of success callback for Stork#reload.

Name Type Description
values Array

An array of all values loaded. This should not be modified.

keys Array

An array of all keys loaded. This should not be modified.

removeFailure(key, error)

The format of failure callback for Stork#remove.

Name Type Description
key Any

The key of the key-value pair that failed to be removed.

error Any

The error that was thrown.

removeManyFailure(values, removed, error)

The format of failure callback for Stork#removeMany.

Name Type Description
values Array

The values removed in the same order of the given keys.

removed Number

The number of records removed before the error occurred.

error Any

The error that was thrown.

removeManySuccess(values, keys)

The format of success callback for Stork#removeMany.

Name Type Description
values Array

The values removed in the same order of the keys. If a key didn't exist then the corresponding value in the array will be undefined.

keys Array

The corresponding removed keys.

removeSuccess(value, key)

The format of success callback for Stork#remove.

Name Type Description
value Any

The value removed or undefined if the key didn't exist.

key Any

The key of the key-value pair that was removed.

saveFailure(record, error)

The format of failure callback for Stork#save.

Name Type Description
record Object

The record that failed to save.

error Any

The error that was thrown.

saveSuccess(record)

The format of success callback for Stork#save.

Name Type Description
record Object

The record that successfully saved.

selectFailure(columns, error)

The format of failure callback for Stork#select.

Name Type Description
columns String | Array

The property you wanted to return or an array of properties to return.

error Any

The error that was thrown.

selectSuccess(values, keys)

The format of success callback for Stork#select.

Name Type Description
values Array

If columns is a string this is an array of values pulled from the same property on all values that are objects. If columns is an array this is an array of objects containing the properties that exist in the columns array.

keys Array

An array of the keys for pointing to the original values.

sizeFailure(error)

The format of failure callback for Stork#size.

Name Type Description
error Any

The error that was thrown.

sizeSuccess(count)

The format of success callback for Stork#size.

Name Type Description
count Number

The total number of key-value pairs.

sortComparator(a, b){Number}

The format of the comparater for Stork#sort.

Name Type Description
a Any

The first value to compare.

b Any

The second value to compare.

Returns:
A negative number if a < b, a positive number of a > b and 0 if a == b.

sortFailure(error)

The format of failure callback for Stork#sort.

Name Type Description
error Any

The error that was thrown.

sortSuccess(values, keys)

The format of success callback for Stork#sort.

Name Type Description
values Array

The array of sorted values.

keys Array

The array of sorted keys.

where(value, key)

The format of the condition callback for Stork#where.

Name Type Description
value Any

The value to inspect and return true if you want it returned.

key Any

The key to inspect and return true if you want it returned.

whereFailure(error)

The format of failure callback for Stork#where.

Name Type Description
error Any

The error that was thrown.

whereSuccess(values, keys)

The format of success callback for Stork#where.

Name Type Description
values Array

The values matching the given condition.

keys Array

The keys matching the given condition.