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:
|
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
Members
-
staticStork.adaptersArray
-
An array of adapters available for implementing a Stork instance. Each item in the array is an object with three properties:
Stringname,Numberpriority, andObjectdefinition.- See:
-
staticStork.pluginsArray
-
An array of all plugin
functions invoked on a Stork instance when it's created.- See:
-
adapterObject
-
The adapter
ObjectwithStringname,Numberpriority, andObjectdefinition properties. The adapter can be chosen based on theoptions.adapterand falls back to the next supported adapter based on priority. -
cacheFastMap
-
The cache of key-value pairs currently loaded. If
Stork#loadedis 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#saveandStork#batchfunctions. This should be specified in theoptionsobject.- 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
optionsobject.- 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, orStork#reload. -
nameString
-
The name used to group the key-value pairs. This is essentially a table name. This should be specified in the
optionsobject.- Default Value:
- ''
-
optionsObject
-
The options passed to the constructor and subsequently to the
Stork#initfunction.- 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 nameString The name of the adapter. Must be unique.
priorityNumber The priority of this adapter. The higher the value the earlier it's checked for support and is used by Stork instances.
definitionfunction | 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#initfunction 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 definitionStork~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
Objectwhich 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 propertyString The property on the object to pass to the accumulation function.
accumulateStork~aggregateAccumulate The function to invoke with the value of the property.
getResultStork~aggregateResult The function to call at the end to returned the aggregated value.
successStork~aggregateSuccess optional The function to invoke when a value is successfully aggregated.
failureStork~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 promiseName Type Description successStork~allSuccess optional The function to invoke with all the key-value pairs.
failureStork~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
Objectvalues to the callback.This is part of the aggregation plugin.
Usage
db.avg('age', function(avg) { // avg = the average age });Name Type Description propertyString The property on the object to average.
successStork~aggregateSuccess optional The function to invoke with the average.
failureStork~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
Objectrecords 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 theStork#initfunction. The property used as the key isthis.keyand by default isid. 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 promiseName Type Description recordsArray The array of objects to save.
successStork~batchSuccess optional The function to invoke when all records are successfully saved.
failureStork~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 propertyString The property on the object to look for.
successStork~aggregateSuccess optional The function to invoke with the number of values with the property.
failureStork~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 promiseName Type Description successStork~destroySuccess optional The function invoked when all key-value pairs are removed.
failureStork~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 & failureName Type Description callbackStork~eachSuccess The function to invoke for each key-value pair.
failureStork~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
undefinedis 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 promiseName Type Description keyAny The key of the key-value pair to get.
successStork~getSuccess optional The function to invoke if a value is successfully found or not found.
failureStork~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 promiseName Type Description keysArray The keys of the key-value pairs to get.
successStork~getManySuccess optional THe function to invoke with the values found.
failureStork~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.lazyis 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 optionsObject The initialization options.
successStork~initSuccess optional The function to invoke when the Stork instance successfully initializes and is usable.
failureStork~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
Objectvalues to the callback.This is part of the aggregation plugin.
Usage
db.max('age', function(max) { // max = the maximum age });Name Type Description propertyString The property on the object to find the maximum value of.
successStork~aggregateSuccess optional The function to invoke with the maximum value.
failureStork~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
Objectvalues to the callback.This is part of the aggregation plugin.
Usage
db.min('age', function(min) { // min = the minimum age });Name Type Description propertyString The property on the object to find the minimum value of.
successStork~aggregateSuccess optional The function to invoke with the minimum value.
failureStork~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 promiseName Type Description keyAny The key to add or update.
valueAny The value to add or update.
successStork~putSuccess optional The function to invoke when the key-value pair is successfully added or updated.
failureStork~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 promiseName Type Description successStork~reloadSuccess optional The function to invoke when all key-value pairs are loaded.
failureStork~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 promiseName Type Description keyAny The key of the key-value pair to remove.
successStork~removeSuccess optional The function to invoke then the key is removed or doesn't exist.
failureStork~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 promiseName Type Description keysArray The array of keys to remove.
successStork~removeManySuccess optional The function to invoke once all matching key-value pairs are removed, with the values removed.
failureStork~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
Objectrecord 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 theStork#initfunction. The property used as the key isthis.keyand by default isid. 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 promiseName Type Description recordObject The record to save.
successStork~saveSuccess optional The function to invoke when the record is successfully saved.
failureStork~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 promiseName Type Description columnsString | Array The property you want to return or an array of properties to return.
successStork~selectSuccess optional The function to invoke with the selected properties.
failureStork~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 promiseName Type Description successStork~sizeSuccess optional The function to invoke with the number of key-value pairs.
failureStork~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 promiseName Type Description comparatorStork~sortComparator The function used to compare two values.
descBoolean If the key-value pairs should be in descending (reversed) order.
successStork~sortSuccess optional The function to invoke with the sorted values & keys.
failureStork~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
Objectvalues to the callback.This is part of the aggregation plugin.
Usage
db.sum('kills', function(sum) { // sum = total of all kills });Name Type Description propertyString The property on the object to sum.
successStork~aggregateSuccess optional The function to invoke with the sum.
failureStork~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.
-
then(callback){Stork.Promise}
-
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 callbackfunction 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 promiseName Type Description conditionStork~where The function to invoke on each key-value pair to determine whether that pair is included in the results.
successStork~whereSuccess optional The function to invoke with the matched key-value pairs.
failureStork~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 valueAny The value to process for accumulation.
-
aggregateFailure(error)
-
The format of failure callback for aggregation functions.
Name Type Description errorAny 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 aggregatedValueNumber The result of the aggregation function.
-
allFailure(error)
-
The format of failure callback for
Stork#all.Name Type Description errorAny The error that was thrown.
-
allSuccess(values, keys)
-
The format of success callback for
Stork#all.Name Type Description valuesArray An array of all values stored. This should not be modified.
keysArray 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 recordsArray The records unsuccessfully saved.
recordsSavedNumber The number of records that successfully saved.
errorAny The error that was thrown.
-
batchSuccess(records)
-
The format of success callback for
Stork#batch.Name Type Description recordsArray The records successfully saved.
-
destroyFailure(error)
-
The format of failure callback for
Stork#destroy.Name Type Description errorAny 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 errorAny The error that was thrown.
-
eachSuccess(value, key)
-
The format of success callback for
Stork#each.Name Type Description valueAny The value of the current key-value pair.
keyAny The key of the current key-value pair.
-
getFailure(key, error)
-
The format of failure callback for
Stork#get.Name Type Description keyAny The key of the key-value pair that was unsuccessfully gotten.
errorAny The error that was thrown.
-
getManyFailure(keys, error)
-
The format of failure callback for
Stork#getMany.Name Type Description keysArray The keys given that resulted in an error.
errorAny The error that was thrown.
-
getManySuccess(values)
-
The format of success callback for
Stork#getMany.Name Type Description valuesArray 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 valueAny The value associated to the given key or
undefinedif one was not found.keyAny The key of the key-value pair that was successfully found.
-
initFailure(error)
-
The format of failure callback for
Stork#init.Name Type Description errorAny The error that was thrown.
-
initSuccess(stork)
-
The format of success callback for
Stork#init.Name Type Description storkStork The reference to this Stork instance.
-
plugin(stork)
-
Name Type Description storkStork The Stork instance to run the plugin on.
-
putFailure(key, value, error)
-
The format of failure callback for
Stork#put.Name Type Description keyAny The key that failed to be added or updated.
valueAny The value that failed to be added or updated.
errorAny The error that was thrown.
-
putSuccess(key, value, previousValue)
-
The format of success callback for
Stork#put.Name Type Description keyAny The key to add or update.
valueAny The value to add or update.
previousValueAny 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 errorAny The error that was thrown.
-
reloadSuccess(values, keys)
-
The format of success callback for
Stork#reload.Name Type Description valuesArray An array of all values loaded. This should not be modified.
keysArray 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 keyAny The key of the key-value pair that failed to be removed.
errorAny The error that was thrown.
-
removeManyFailure(values, removed, error)
-
The format of failure callback for
Stork#removeMany.Name Type Description valuesArray The values removed in the same order of the given keys.
removedNumber The number of records removed before the error occurred.
errorAny The error that was thrown.
-
removeManySuccess(values, keys)
-
The format of success callback for
Stork#removeMany.Name Type Description valuesArray 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.keysArray The corresponding removed keys.
-
removeSuccess(value, key)
-
The format of success callback for
Stork#remove.Name Type Description valueAny The value removed or
undefinedif the key didn't exist.keyAny The key of the key-value pair that was removed.
-
saveFailure(record, error)
-
The format of failure callback for
Stork#save.Name Type Description recordObject The record that failed to save.
errorAny The error that was thrown.
-
saveSuccess(record)
-
The format of success callback for
Stork#save.Name Type Description recordObject The record that successfully saved.
-
selectFailure(columns, error)
-
The format of failure callback for
Stork#select.Name Type Description columnsString | Array The property you wanted to return or an array of properties to return.
errorAny The error that was thrown.
-
selectSuccess(values, keys)
-
The format of success callback for
Stork#select.Name Type Description valuesArray 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.
keysArray An array of the keys for pointing to the original values.
-
sizeFailure(error)
-
The format of failure callback for
Stork#size.Name Type Description errorAny The error that was thrown.
-
sizeSuccess(count)
-
The format of success callback for
Stork#size.Name Type Description countNumber The total number of key-value pairs.
-
sortComparator(a, b){Number}
-
The format of the comparater for
Stork#sort.Name Type Description aAny The first value to compare.
bAny The second value to compare.
Returns:
A negative number ifa < b, a positive number ofa > band 0 ifa == b.
-
sortFailure(error)
-
The format of failure callback for
Stork#sort.Name Type Description errorAny The error that was thrown.
-
sortSuccess(values, keys)
-
The format of success callback for
Stork#sort.Name Type Description valuesArray The array of sorted values.
keysArray The array of sorted keys.
-
where(value, key)
-
The format of the condition callback for
Stork#where.Name Type Description valueAny The value to inspect and return true if you want it returned.
keyAny 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 errorAny The error that was thrown.
-
whereSuccess(values, keys)
-
The format of success callback for
Stork#where.Name Type Description valuesArray The values matching the given condition.
keysArray The keys matching the given condition.