Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Update collection methods #570

Open
wants to merge 3 commits into
base: 1.0.0
Choose a base branch
from
Open

Conversation

the-overengineer
Copy link

Update the async library to 2.1.x and update the code and tests to reflect this.

The most important changes are that some methods that previously took next functions and callbacks that only had an arity of one now have an arity of 2. For example, filter can now be called as:

collection.filter(function(item, next) {
  if (item.id < 0) {
     return next(err);
  }

  next(null, item.id % 2 === 0);
}, function(err, filtered) {
  if (!err) {
    console.log('Filtered:', filtered);
  }
});

The following methods (method aliases given in brackets) are affected:

  • filter (select)
  • reject
  • detect
  • some (any)
  • every (all)

Fixes #569

Makes these PRs redundant:

@coveralls
Copy link

coveralls commented Nov 16, 2016

Coverage Status

Coverage decreased (-0.2%) to 89.181% when pulling af08312 on fix-collection-filter into 6abcae0 on master.

@the-overengineer
Copy link
Author

It's our old friend, the Jwt has expired error.

@robertjd robertjd changed the base branch from master to 1.0.0 November 16, 2016 20:15
@robertjd
Copy link
Member

Thanks @Tweety-FER ! I've created a new 1.0.0 branch, and changed this PR to use that branch as the base. Let's start making any breaking change PRs into that branch, with the eventual goal to release a next major version.

I've tried running the express-stormpath tests while linked to these SDK changes, and most of the tests are failing. Can you take a look at the cause? I'd like to ensure that we've captured all places in this SDK where we need to update our async calls, and the express-stormpath tests are a good way to find places we don't have covered in the SDK tests

@coveralls
Copy link

coveralls commented Nov 17, 2016

Coverage Status

Coverage decreased (-0.2%) to 89.181% when pulling 4352359 on fix-collection-filter into 6abcae0 on 1.0.0.

@the-overengineer
Copy link
Author

@robertjd Thanks for pointing that out. Updated the example in this repo and fiddled with the express lib to see what's going on. After pointing the dep at this branch and fixing a couple of lines of code in the express lib, the errors apparently went away. Is it the same for you? It's this PR: stormpath/express-stormpath#546

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants