Skip to content

Instantly share code, notes, and snippets.

@coffeemug
Created July 2, 2013 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coffeemug/5905908 to your computer and use it in GitHub Desktop.
Save coffeemug/5905908 to your computer and use it in GitHub Desktop.
An example of poor API documentation

RethinkDB: The concatMap command in Javascript

Declaration

sequence.concatMap(mappingFunction) -> stream
array.concatMap(mappingFunction) -> array

Description

Flattens a sequence of arrays returned by the mappingFunction into a single sequence.

Example

Construct a sequence of all monsters defeated by Marvel heroes. Here the field 'defeatedMonsters' is a list that is concatenated to the sequence.

r.table('marvel').concatMap(function(hero) {
  return hero('defeatedMonsters')
}).run(conn, callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment