1.0.1 • Published 9 years ago

laterlist v1.0.1

Weekly downloads
29
License
MIT
Repository
github
Last release
9 years ago

LaterList Build Status

Handle asynchronous events as an array that will arrive eventually: a LaterList.

Install

Available via npm

npm install laterlist

Usage

var Flood = require('LaterList').Flood;

// Works like an array
Flood.of(1,2,3,4,5)
  .map(function(n) {
    return n + 2;
  }).filter(function(n) {
    return n % 2 === 0;
  }).reduce(function(total, n) {
    return total + n;
  }, 0).then(console.log); // 10

// even when callbacks resolve asynchronously
Flood.from(someUserIds)
  .map(db.getUserByIdAsync)
  .reduce(function(pageViews, user) {
    return pageViews + user.pageViews;
  }, 0).then(console.log); // Sum total of page views of those users.

Source

https://github.com/will-weiss/LaterList

License

Released under the MIT License.

LaterList

A LaterList is a linked list which may be used to process values that arrive or are processed asynchronously. As in many implementations of streams, listeners may be added to instances of LaterList to process incoming values. There are however some differences that make LaterList useful.

Classes

Kind: global class
Extends: LaterList

laterList/Flood.length : Number

Number of nodes in the list.

Kind: instance property of LaterList/Flood

laterList/Flood.addListener(onData, onEnd, initialValue)

Adds a listener which processes values of this flood as soon as they arrive.

Kind: instance method of LaterList/Flood

ParamTypeDescription
onDatafunctionA function applied to each node.
onEndfunctionA function to execute on end.
initialValue*An initial value.

laterList/Flood.push(...values) ⇒ Number

Adds a values to the list's tail. Pending listeners are revived and shifted.

Kind: instance method of LaterList/Flood
Returns: Number - The new length of the list.

ParamTypeDescription
...values*The values to add to the end of the list.

laterList/Flood.revive(fn, err)

Executes a Listener.prototype function on each pending listener.

Kind: instance method of LaterList/Flood

ParamTypeDescription
fnfunctionA Listener.prototype function.
errErrorOptional. An error to pass to pending listeners.

laterList/Flood.end(err)

Indicates that no more nodes will be added to the list. If an argument is present it is interpreted as an error which will immediately end all listeners. If no argument is present, listeners will end when they have processed all nodes of the list. Subsequent calls of push and end on this list will throw.

Kind: instance method of LaterList/Flood

ParamTypeDescription
errerrorAn optional error.

laterList/Flood.link(onData) ⇒

Return a new LaterList instance whose nodes are the result of applying the supplied onData function to each node of this list.

Kind: instance method of LaterList/Flood
Returns: LaterList A LaterList of the same subclass as this list.

ParamTypeDescription
onDatafunctionA function to process nodes of this list executed in the context of the listener.

laterList/Flood.close()

Indicates that no more listeners will be added to this list. The reference to the head of the list is removed so that nodes processed by each listener may be garbage colllected. Subsequent calls of close, atIndex and adding of listeners on this list will throw as these methods require a reference to the list's head.

Kind: instance method of LaterList/Flood

laterList/Flood.consume(onData, initialValue) ⇒ Promise.<*>

Returns a promise that resolves with the final value of a listener.

Kind: instance method of LaterList/Flood
Returns: Promise.<*> - The result of the computation of the listener.

ParamTypeDescription
onDatafunctionA function to process nodes of this list executed in the context of the listener.
initialValue*An initial value set on the listener.

laterList/Flood.value() ⇒ Promise.<Array.<*>>

Collect the nodes of the list as an array.

Kind: instance method of LaterList/Flood
Returns: Promise.<Array.<*>> - Resolves with the values of the list's nodes.

laterList/Flood.atIndex(index) ⇒ *

Looks up the value of the node at the supplied index. Returns undefined if the index is not a number or out of bounds.

Kind: instance method of LaterList/Flood
Returns: * - The value of the node at that index.

ParamTypeDescription
indexNumberAn index of the list.

laterList/Flood.when() ⇒ Promise

Resolves with undefined if the list ends without error, rejects if the list ends with an error.

Kind: instance method of LaterList/Flood

laterList/Flood.concat(...lists) ⇒ LaterList

Returns a new list comprised of the list on which it is called joined with the list-like(s) and/or value(s) provided as arguments.

Kind: instance method of LaterList/Flood
Returns: LaterList - A list whose nodes have the concatenated values of the supplied arguments.

ParamTypeDescription
...listsObject.<{forEach: function()}>list-likes to concatenate to this list.

laterList/Flood.every(predicate, thisArg) ⇒ Promise.<Boolean>

Tests whether all nodes in the list pass the test implemented by the provided function.

Kind: instance method of LaterList/Flood
Returns: Promise.<Boolean> - true if the predicate is true for all nodes in the list, false otherwise.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Flood.filter(predicate, thisArg) ⇒ LaterList

Creates a new LaterList with all nodes that pass the test implemented by the provided function.

Kind: instance method of LaterList/Flood
Returns: LaterList - A list with the filtered values of the original list.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Flood.find(predicate, thisArg) ⇒ Promise.<*>

Returns a value in the list, if a node in the list satisfies the provided testing function. Otherwise undefined is returned.

Kind: instance method of LaterList/Flood
Returns: Promise.<*> - The value of the first node to satisfy the predicate.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Flood.findIndex(predicate, thisArg) ⇒ Promise.<Number>

Returns an index in the list, if a node in the list satisfies the provided testing function. Otherwise -1 is returned.

Kind: instance method of LaterList/Flood
Returns: Promise.<Number> - The first index of a node satisfying the predicate.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Flood.forEach(lambda, thisArg) ⇒ Promise.<undefined>

Executes a provided function once per node.

Kind: instance method of LaterList/Flood
Returns: Promise.<undefined> - Resolves when processing has ended.

ParamTypeDescription
lambdafunctionFunction to execute for each element
thisArgObjectOptional. Value to use as this when executing the lambda.

laterList/Flood.includes(toMatch, fromIndex) ⇒ Promise.<Boolean>

Determines whether a list includes a certain element, returning true or false as appropriate.

Kind: instance method of LaterList/Flood
Returns: Promise.<Boolean> - Whether the value appears in the list.

ParamTypeDescription
toMatch*A value to match.
fromIndexNumberOptional. The position in this list at which to begin searching for searchElement; defaults to 0.

laterList/Flood.indexOf(toMatch) ⇒ Promise.<Number>

Returns the first index at which a given value can be found in the list, or -1 if it is not present.

Kind: instance method of LaterList/Flood
Returns: Promise.<Number> - The first index of a node with the supplied value.

ParamTypeDescription
toMatch*A value to match.

laterList/Flood.join(separator) ⇒ Promise.<String>

Joins all values of a list into a string.

Kind: instance method of LaterList/Flood

ParamTypeDescription
separatorStringSpecifies a string to separate each value of the list.

laterList/Flood.lastIndexOf(toMatch) ⇒ Promise.<Number>

Returns the last index at which a given value can be found in the list, or -1 if it is not present.

Kind: instance method of LaterList/Flood
Returns: Promise.<Number> - The last index of a node with the supplied value.

ParamTypeDescription
toMatch*A value to match.

laterList/Flood.map(lambda, thisArg) ⇒ LaterList

Creates a new list with the results of calling a provided function on every node in this list.

Kind: instance method of LaterList/Flood
Returns: LaterList - A new list with the results of mapping the lambda over this list.

ParamTypeDescription
lambdafunctionFunction to execute for each element
thisArgObjectOptional. Value to use as this when executing the lambda.

laterList/Flood.reduce(lambda, initialValue) ⇒ Promise.<*>

Applies a function against an accumulator and each node of the list (from left-to-right) has to reduce it to a single value.

Kind: instance method of LaterList/Flood
Returns: Promise.<*> - The reduced value.

ParamTypeDescription
lambdafunctionFunction to execute for each element
initialValue*Optional. Object to use as the first argument to the first call of the lambda.

laterList/Flood.reduceRight(lambda, initialValue) ⇒ Promise.<*>

Applies a function against an accumulator and each node of the list (from right-to-left) has to reduce it to a single value. Note that this operation can only commence when the list has ended and been reversed. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList/Flood
Returns: Promise.<*> - The reduced value.

ParamTypeDescription
lambdafunctionFunction to execute for each element
initialValue*Optional. Object to use as the first argument to the first call of the lambda.

laterList/Flood.reverse() ⇒ LaterList

Returns a reversed list. The first list node becomes the last and the last becomes the first. Note that while this operation maintains a copy of each node and can only complete when the list has ended. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList/Flood
Returns: LaterList - A new list with the values of this list reversed.

laterList/Flood.slice(begin, end) ⇒ LaterList

Returns a shallow copy of a portion of a list into a new list.

Kind: instance method of LaterList/Flood
Returns: LaterList - A list with the sliced portion of this list.

ParamTypeDescription
beginNumberAn index to begin at.
endNumberAn index to end at.

laterList/Flood.some(predicate, thisArg) ⇒ Promise.<Boolean>

Tests whether some element in the list passes the test implemented by the provided function.

Kind: instance method of LaterList/Flood
Returns: Promise.<Boolean> - true if the predicate is true for some node in the list, false otherwise.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing predicate.

laterList/Flood.sort(compare) ⇒ LaterList

Returns a LaterList with the sorted nodes of this list. Note that this operation can only commence when the list has ended and requires all the values of the list collected in an array before they are sorted and copied to the resulting list. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList/Flood
Returns: LaterList - A new list with sorted values from this list.

ParamTypeDescription
comparefunctionOptional. A function on which to sort.

laterList/Flood.splice(begin, deleteCount, ...additions) ⇒ LaterList

Returns a new list with some nodes in this list removed and/or some nodes added.

Kind: instance method of LaterList/Flood
Returns: LaterList - A new list with the modified values from this list.

ParamTypeDescription
beginNumberAn index to begin at.
deleteCountNumberThe number of elements to remove.
...additions*Values to add to the list.

LaterList/Relay ⇐ LaterList

A Relay is a LaterList for which order is preserved when listened to.

Kind: global class
Extends: LaterList

laterList/Relay.length : Number

Number of nodes in the list.

Kind: instance property of LaterList/Relay

laterList/Relay.addListener(onData, onEnd, initialValue)

Adds a listener which processes values of this relay when all prior values have been processed.

Kind: instance method of LaterList/Relay

ParamTypeDescription
onDatafunctionA function applied to each node.
onEndfunctionA function to execute on end.
initialValue*An initial value.

laterList/Relay.push(...values) ⇒ Number

Adds a values to the list's tail. Pending listeners are revived and shifted.

Kind: instance method of LaterList/Relay
Returns: Number - The new length of the list.

ParamTypeDescription
...values*The values to add to the end of the list.

laterList/Relay.revive(fn, err)

Executes a Listener.prototype function on each pending listener.

Kind: instance method of LaterList/Relay

ParamTypeDescription
fnfunctionA Listener.prototype function.
errErrorOptional. An error to pass to pending listeners.

laterList/Relay.end(err)

Indicates that no more nodes will be added to the list. If an argument is present it is interpreted as an error which will immediately end all listeners. If no argument is present, listeners will end when they have processed all nodes of the list. Subsequent calls of push and end on this list will throw.

Kind: instance method of LaterList/Relay

ParamTypeDescription
errerrorAn optional error.

laterList/Relay.link(onData) ⇒

Return a new LaterList instance whose nodes are the result of applying the supplied onData function to each node of this list.

Kind: instance method of LaterList/Relay
Returns: LaterList A LaterList of the same subclass as this list.

ParamTypeDescription
onDatafunctionA function to process nodes of this list executed in the context of the listener.

laterList/Relay.close()

Indicates that no more listeners will be added to this list. The reference to the head of the list is removed so that nodes processed by each listener may be garbage colllected. Subsequent calls of close, atIndex and adding of listeners on this list will throw as these methods require a reference to the list's head.

Kind: instance method of LaterList/Relay

laterList/Relay.consume(onData, initialValue) ⇒ Promise.<*>

Returns a promise that resolves with the final value of a listener.

Kind: instance method of LaterList/Relay
Returns: Promise.<*> - The result of the computation of the listener.

ParamTypeDescription
onDatafunctionA function to process nodes of this list executed in the context of the listener.
initialValue*An initial value set on the listener.

laterList/Relay.value() ⇒ Promise.<Array.<*>>

Collect the nodes of the list as an array.

Kind: instance method of LaterList/Relay
Returns: Promise.<Array.<*>> - Resolves with the values of the list's nodes.

laterList/Relay.atIndex(index) ⇒ *

Looks up the value of the node at the supplied index. Returns undefined if the index is not a number or out of bounds.

Kind: instance method of LaterList/Relay
Returns: * - The value of the node at that index.

ParamTypeDescription
indexNumberAn index of the list.

laterList/Relay.when() ⇒ Promise

Resolves with undefined if the list ends without error, rejects if the list ends with an error.

Kind: instance method of LaterList/Relay

laterList/Relay.concat(...lists) ⇒ LaterList

Returns a new list comprised of the list on which it is called joined with the list-like(s) and/or value(s) provided as arguments.

Kind: instance method of LaterList/Relay
Returns: LaterList - A list whose nodes have the concatenated values of the supplied arguments.

ParamTypeDescription
...listsObject.<{forEach: function()}>list-likes to concatenate to this list.

laterList/Relay.every(predicate, thisArg) ⇒ Promise.<Boolean>

Tests whether all nodes in the list pass the test implemented by the provided function.

Kind: instance method of LaterList/Relay
Returns: Promise.<Boolean> - true if the predicate is true for all nodes in the list, false otherwise.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Relay.filter(predicate, thisArg) ⇒ LaterList

Creates a new LaterList with all nodes that pass the test implemented by the provided function.

Kind: instance method of LaterList/Relay
Returns: LaterList - A list with the filtered values of the original list.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Relay.find(predicate, thisArg) ⇒ Promise.<*>

Returns a value in the list, if a node in the list satisfies the provided testing function. Otherwise undefined is returned.

Kind: instance method of LaterList/Relay
Returns: Promise.<*> - The value of the first node to satisfy the predicate.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Relay.findIndex(predicate, thisArg) ⇒ Promise.<Number>

Returns an index in the list, if a node in the list satisfies the provided testing function. Otherwise -1 is returned.

Kind: instance method of LaterList/Relay
Returns: Promise.<Number> - The first index of a node satisfying the predicate.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList/Relay.forEach(lambda, thisArg) ⇒ Promise.<undefined>

Executes a provided function once per node.

Kind: instance method of LaterList/Relay
Returns: Promise.<undefined> - Resolves when processing has ended.

ParamTypeDescription
lambdafunctionFunction to execute for each element
thisArgObjectOptional. Value to use as this when executing the lambda.

laterList/Relay.includes(toMatch, fromIndex) ⇒ Promise.<Boolean>

Determines whether a list includes a certain element, returning true or false as appropriate.

Kind: instance method of LaterList/Relay
Returns: Promise.<Boolean> - Whether the value appears in the list.

ParamTypeDescription
toMatch*A value to match.
fromIndexNumberOptional. The position in this list at which to begin searching for searchElement; defaults to 0.

laterList/Relay.indexOf(toMatch) ⇒ Promise.<Number>

Returns the first index at which a given value can be found in the list, or -1 if it is not present.

Kind: instance method of LaterList/Relay
Returns: Promise.<Number> - The first index of a node with the supplied value.

ParamTypeDescription
toMatch*A value to match.

laterList/Relay.join(separator) ⇒ Promise.<String>

Joins all values of a list into a string.

Kind: instance method of LaterList/Relay

ParamTypeDescription
separatorStringSpecifies a string to separate each value of the list.

laterList/Relay.lastIndexOf(toMatch) ⇒ Promise.<Number>

Returns the last index at which a given value can be found in the list, or -1 if it is not present.

Kind: instance method of LaterList/Relay
Returns: Promise.<Number> - The last index of a node with the supplied value.

ParamTypeDescription
toMatch*A value to match.

laterList/Relay.map(lambda, thisArg) ⇒ LaterList

Creates a new list with the results of calling a provided function on every node in this list.

Kind: instance method of LaterList/Relay
Returns: LaterList - A new list with the results of mapping the lambda over this list.

ParamTypeDescription
lambdafunctionFunction to execute for each element
thisArgObjectOptional. Value to use as this when executing the lambda.

laterList/Relay.reduce(lambda, initialValue) ⇒ Promise.<*>

Applies a function against an accumulator and each node of the list (from left-to-right) has to reduce it to a single value.

Kind: instance method of LaterList/Relay
Returns: Promise.<*> - The reduced value.

ParamTypeDescription
lambdafunctionFunction to execute for each element
initialValue*Optional. Object to use as the first argument to the first call of the lambda.

laterList/Relay.reduceRight(lambda, initialValue) ⇒ Promise.<*>

Applies a function against an accumulator and each node of the list (from right-to-left) has to reduce it to a single value. Note that this operation can only commence when the list has ended and been reversed. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList/Relay
Returns: Promise.<*> - The reduced value.

ParamTypeDescription
lambdafunctionFunction to execute for each element
initialValue*Optional. Object to use as the first argument to the first call of the lambda.

laterList/Relay.reverse() ⇒ LaterList

Returns a reversed list. The first list node becomes the last and the last becomes the first. Note that while this operation maintains a copy of each node and can only complete when the list has ended. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList/Relay
Returns: LaterList - A new list with the values of this list reversed.

laterList/Relay.slice(begin, end) ⇒ LaterList

Returns a shallow copy of a portion of a list into a new list.

Kind: instance method of LaterList/Relay
Returns: LaterList - A list with the sliced portion of this list.

ParamTypeDescription
beginNumberAn index to begin at.
endNumberAn index to end at.

laterList/Relay.some(predicate, thisArg) ⇒ Promise.<Boolean>

Tests whether some element in the list passes the test implemented by the provided function.

Kind: instance method of LaterList/Relay
Returns: Promise.<Boolean> - true if the predicate is true for some node in the list, false otherwise.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing predicate.

laterList/Relay.sort(compare) ⇒ LaterList

Returns a LaterList with the sorted nodes of this list. Note that this operation can only commence when the list has ended and requires all the values of the list collected in an array before they are sorted and copied to the resulting list. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList/Relay
Returns: LaterList - A new list with sorted values from this list.

ParamTypeDescription
comparefunctionOptional. A function on which to sort.

laterList/Relay.splice(begin, deleteCount, ...additions) ⇒ LaterList

Returns a new list with some nodes in this list removed and/or some nodes added.

Kind: instance method of LaterList/Relay
Returns: LaterList - A new list with the modified values from this list.

ParamTypeDescription
beginNumberAn index to begin at.
deleteCountNumberThe number of elements to remove.
...additions*Values to add to the list.

LaterList

A LaterList is a linked list which may be used to process values that arrive or are processed asynchronously.

Kind: global class

laterList.length : Number

Number of nodes in the list.

Kind: instance property of LaterList

laterList.push(...values) ⇒ Number

Adds a values to the list's tail. Pending listeners are revived and shifted.

Kind: instance method of LaterList
Returns: Number - The new length of the list.

ParamTypeDescription
...values*The values to add to the end of the list.

laterList.revive(fn, err)

Executes a Listener.prototype function on each pending listener.

Kind: instance method of LaterList

ParamTypeDescription
fnfunctionA Listener.prototype function.
errErrorOptional. An error to pass to pending listeners.

laterList.end(err)

Indicates that no more nodes will be added to the list. If an argument is present it is interpreted as an error which will immediately end all listeners. If no argument is present, listeners will end when they have processed all nodes of the list. Subsequent calls of push and end on this list will throw.

Kind: instance method of LaterList

ParamTypeDescription
errerrorAn optional error.

laterList.link(onData) ⇒

Return a new LaterList instance whose nodes are the result of applying the supplied onData function to each node of this list.

Kind: instance method of LaterList
Returns: LaterList A LaterList of the same subclass as this list.

ParamTypeDescription
onDatafunctionA function to process nodes of this list executed in the context of the listener.

laterList.close()

Indicates that no more listeners will be added to this list. The reference to the head of the list is removed so that nodes processed by each listener may be garbage colllected. Subsequent calls of close, atIndex and adding of listeners on this list will throw as these methods require a reference to the list's head.

Kind: instance method of LaterList

laterList.consume(onData, initialValue) ⇒ Promise.<*>

Returns a promise that resolves with the final value of a listener.

Kind: instance method of LaterList
Returns: Promise.<*> - The result of the computation of the listener.

ParamTypeDescription
onDatafunctionA function to process nodes of this list executed in the context of the listener.
initialValue*An initial value set on the listener.

laterList.value() ⇒ Promise.<Array.<*>>

Collect the nodes of the list as an array.

Kind: instance method of LaterList
Returns: Promise.<Array.<*>> - Resolves with the values of the list's nodes.

laterList.atIndex(index) ⇒ *

Looks up the value of the node at the supplied index. Returns undefined if the index is not a number or out of bounds.

Kind: instance method of LaterList
Returns: * - The value of the node at that index.

ParamTypeDescription
indexNumberAn index of the list.

laterList.when() ⇒ Promise

Resolves with undefined if the list ends without error, rejects if the list ends with an error.

Kind: instance method of LaterList

laterList.concat(...lists) ⇒ LaterList

Returns a new list comprised of the list on which it is called joined with the list-like(s) and/or value(s) provided as arguments.

Kind: instance method of LaterList
Returns: LaterList - A list whose nodes have the concatenated values of the supplied arguments.

ParamTypeDescription
...listsObject.<{forEach: function()}>list-likes to concatenate to this list.

laterList.every(predicate, thisArg) ⇒ Promise.<Boolean>

Tests whether all nodes in the list pass the test implemented by the provided function.

Kind: instance method of LaterList
Returns: Promise.<Boolean> - true if the predicate is true for all nodes in the list, false otherwise.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList.filter(predicate, thisArg) ⇒ LaterList

Creates a new LaterList with all nodes that pass the test implemented by the provided function.

Kind: instance method of LaterList
Returns: LaterList - A list with the filtered values of the original list.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList.find(predicate, thisArg) ⇒ Promise.<*>

Returns a value in the list, if a node in the list satisfies the provided testing function. Otherwise undefined is returned.

Kind: instance method of LaterList
Returns: Promise.<*> - The value of the first node to satisfy the predicate.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList.findIndex(predicate, thisArg) ⇒ Promise.<Number>

Returns an index in the list, if a node in the list satisfies the provided testing function. Otherwise -1 is returned.

Kind: instance method of LaterList
Returns: Promise.<Number> - The first index of a node satisfying the predicate.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing the predicate.

laterList.forEach(lambda, thisArg) ⇒ Promise.<undefined>

Executes a provided function once per node.

Kind: instance method of LaterList
Returns: Promise.<undefined> - Resolves when processing has ended.

ParamTypeDescription
lambdafunctionFunction to execute for each element
thisArgObjectOptional. Value to use as this when executing the lambda.

laterList.includes(toMatch, fromIndex) ⇒ Promise.<Boolean>

Determines whether a list includes a certain element, returning true or false as appropriate.

Kind: instance method of LaterList
Returns: Promise.<Boolean> - Whether the value appears in the list.

ParamTypeDescription
toMatch*A value to match.
fromIndexNumberOptional. The position in this list at which to begin searching for searchElement; defaults to 0.

laterList.indexOf(toMatch) ⇒ Promise.<Number>

Returns the first index at which a given value can be found in the list, or -1 if it is not present.

Kind: instance method of LaterList
Returns: Promise.<Number> - The first index of a node with the supplied value.

ParamTypeDescription
toMatch*A value to match.

laterList.join(separator) ⇒ Promise.<String>

Joins all values of a list into a string.

Kind: instance method of LaterList

ParamTypeDescription
separatorStringSpecifies a string to separate each value of the list.

laterList.lastIndexOf(toMatch) ⇒ Promise.<Number>

Returns the last index at which a given value can be found in the list, or -1 if it is not present.

Kind: instance method of LaterList
Returns: Promise.<Number> - The last index of a node with the supplied value.

ParamTypeDescription
toMatch*A value to match.

laterList.map(lambda, thisArg) ⇒ LaterList

Creates a new list with the results of calling a provided function on every node in this list.

Kind: instance method of LaterList
Returns: LaterList - A new list with the results of mapping the lambda over this list.

ParamTypeDescription
lambdafunctionFunction to execute for each element
thisArgObjectOptional. Value to use as this when executing the lambda.

laterList.reduce(lambda, initialValue) ⇒ Promise.<*>

Applies a function against an accumulator and each node of the list (from left-to-right) has to reduce it to a single value.

Kind: instance method of LaterList
Returns: Promise.<*> - The reduced value.

ParamTypeDescription
lambdafunctionFunction to execute for each element
initialValue*Optional. Object to use as the first argument to the first call of the lambda.

laterList.reduceRight(lambda, initialValue) ⇒ Promise.<*>

Applies a function against an accumulator and each node of the list (from right-to-left) has to reduce it to a single value. Note that this operation can only commence when the list has ended and been reversed. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList
Returns: Promise.<*> - The reduced value.

ParamTypeDescription
lambdafunctionFunction to execute for each element
initialValue*Optional. Object to use as the first argument to the first call of the lambda.

laterList.reverse() ⇒ LaterList

Returns a reversed list. The first list node becomes the last and the last becomes the first. Note that while this operation maintains a copy of each node and can only complete when the list has ended. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList
Returns: LaterList - A new list with the values of this list reversed.

laterList.slice(begin, end) ⇒ LaterList

Returns a shallow copy of a portion of a list into a new list.

Kind: instance method of LaterList
Returns: LaterList - A list with the sliced portion of this list.

ParamTypeDescription
beginNumberAn index to begin at.
endNumberAn index to end at.

laterList.some(predicate, thisArg) ⇒ Promise.<Boolean>

Tests whether some element in the list passes the test implemented by the provided function.

Kind: instance method of LaterList
Returns: Promise.<Boolean> - true if the predicate is true for some node in the list, false otherwise.

ParamTypeDescription
predicatefunctionFunction to test for each element.
thisArgObjectOptional. Value to use as this when executing predicate.

laterList.sort(compare) ⇒ LaterList

Returns a LaterList with the sorted nodes of this list. Note that this operation can only commence when the list has ended and requires all the values of the list collected in an array before they are sorted and copied to the resulting list. As this is computationally expensive, finding other approaches is recommended.

Kind: instance method of LaterList
Returns: LaterList - A new list with sorted values from this list.

ParamTypeDescription
comparefunctionOptional. A function on which to sort.

laterList.splice(begin, deleteCount, ...additions) ⇒ LaterList

Returns a new list with some nodes in this list removed and/or some nodes added.

Kind: instance method of LaterList
Returns: LaterList - A new list with the modified values from this list.

ParamTypeDescription
beginNumberAn index to begin at.
deleteCountNumberThe number of elements to remove.
...additions*Values to add to the list.

LaterList.from(listLike, mapFn, thisArg) ⇒

Creates a new LaterList instance from an list-like object with a forEach method. The new list ends when the execution of forEach resolves.

Kind: static method of LaterList
Returns: LaterList An instance of LaterList whose nodes have values equal to those of the supplied list-like.

ParamTypeDescription
listLikeObject.<{forEach: function()}>An object to create a list from.
mapFnfunctionOptional. Map function to call on every element of the list.
thisArgObjectOptional. Value to use as this when executing mapFn.

LaterList.of(...values) ⇒

Creates a new LaterList instance with a variable number of arguments.

Kind: static method of LaterList
Returns: LaterList An instance of LaterList whose nodes have values equal to those of the supplied arguments.

ParamTypeDescription
...values*The values to add to a new list.