Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 6.0 / Node v4.2.4+ Peer Review for v6.0.0 #73

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
779dd55
[package, prep] prep version # for v6.0.0!
edwardhotchkiss Jan 4, 2016
cda8344
[travis, test] test starting on 4.2. reason being for "harmony"
edwardhotchkiss Jan 8, 2016
ff90322
[travis, test] added stable
edwardhotchkiss Jan 8, 2016
0c7c89c
[test] remove console logs
edwardhotchkiss Jan 8, 2016
9020404
[fix, error handling] catch error on promise => callback
edwardhotchkiss Jan 8, 2016
67dc751
[promises] resolve result if no cb
edwardhotchkiss Jan 8, 2016
1fa8a35
[deps] more range on mongoose
edwardhotchkiss Jan 8, 2016
c81fc3e
[license] added @Jokero to license
edwardhotchkiss Jan 9, 2016
8236882
[major, es6] 8 passing, 5 tests failing
edwardhotchkiss Jan 9, 2016
beb90fa
[tests, cleanup] 5 failing tests commented out, fixing and diving deeper
edwardhotchkiss Jan 9, 2016
9c0fd24
[major, tests, fixes] ES6 = 9/13 tests passing
edwardhotchkiss Jan 9, 2016
fadddcf
[fix, tests] all tests working except for totals
edwardhotchkiss Jan 9, 2016
0a139e9
[tests, RC6.0] working, all tests passing
edwardhotchkiss Jan 9, 2016
323fe54
Merge branch 'master' into ES6-6.0
edwardhotchkiss Jan 9, 2016
5a881ae
[regression] revert several features back to 5.0
edwardhotchkiss Jan 10, 2016
7a8a11c
[debug] remove mongoose debug
edwardhotchkiss Jan 10, 2016
7867da7
[limit:0] back to original 5.0 feature set, all tests passing
edwardhotchkiss Jan 11, 2016
d8e8299
[minor] license, removed hanging space
edwardhotchkiss Jan 11, 2016
8581975
Simple way to handle create required promises
lesterzone Apr 29, 2016
3366694
Merge pull request #85 from lesterzone/internal-promises
niftylettuce Sep 29, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: node_js

node_js:
- "4.2.4"
- "4.2"
- "stable"

services:
- mongodb
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ function paginate(query, options, callback) {
if (typeof callback === 'function') {
return callback(null, result);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not return result of callback as promise value:

if (typeof callback === 'function') {
  callback(null, result);
}
return Promise.resolve(result);

}
let promise = new Promise();
promise.resolve(result);
return promise;
return Promise.resolve(result);
}).catch((error) => {
return callback(error);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So better?

if (typeof callback === 'function') {
  callback(error);
  return Promise.reject(error);
}

});
}

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mongoose-paginate",
"description": "Pagination plugin for Mongoose",
"version": "5.0.0",
"version": "6.0.0",
"author": {
"name": "Edward Hotchkiss",
"email": "edward@edwardhotchkiss.com"
Expand Down Expand Up @@ -33,13 +33,13 @@
"page"
],
"engines": {
"node": ">=4.2.4"
"node": ">=4.2"
},
"dependencies": {},
"devDependencies": {
"mongoose": "4.3.4",
"mocha": "2.3.4",
"chai": "3.4.1"
"mongoose": ">=4.2",
"mocha": "~2.3.4",
"chai": "~3.4.1"
},
"scripts": {
"test": "./node_modules/.bin/mocha tests/*.js -R spec --ui bdd --timeout 5000"
Expand Down
2 changes: 0 additions & 2 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ describe('mongoose-paginate', function() {
describe('paginates', function() {
it('with criteria', function() {
return Book.paginate({ title: 'Book #10' }).then((result) => {
console.log('with criteria logging ==================');
console.log('result:', result);
expect(result.docs).to.have.length(1);
expect(result.docs[0].title).to.equal('Book #10');
});
Expand Down