glynnbird opened a new pull request #102: Promise support for Nano - Issue 98 URL: https://github.com/apache/couchdb-nano/pull/102 ## Overview Aimed at a v7.x release of Nano, this PR makes Nano return a _Promise_ instead of a _Request_ object as its return value. See https://github.com/apache/couchdb-nano/issues/98. This brings Nano into the modern world without breaking code that uses the callback style. It only breaks code that relied on the events emitted from the Request object or that piped the stream to another stream. Work done in this PR: - most functions return a _Promise_ - new ...AsStream| functions are availble for operations that return lots of data. These return a _Request_ object - test suite updated - README changed to reflect the new API - TypeScript definitions updated too - written `migration_6_to_7` guide ## Testing recommendations The tests have been updated to reflect the change. Instantiate a Nano instance and most operations will return a _Promise_: ```js var nano = require('.') var n = nano('http://localhost:5984') var db = n.db.use('animals') db.list({start_key:'cat1',end_key:'cat4'}) .then(console.log) .catch(console.error) ``` ## GitHub issue number https://github.com/apache/couchdb-nano/issues/98 ## Related Pull Requests n/a ## Checklist - [x] Code is written and works correctly; - [x] Changes are covered by tests; - [x] Documentation reflects the changes;
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
