Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 57330cc

Browse files
committed
makeNodeResolver - compact additional args into an array.
1 parent 0569ebd commit 57330cc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@
230230
makeNodeResolver:function(deferred){
231231
return function(err,result){
232232
if(err === null){
233+
if(arguments.length > 2){
234+
result = Array.prototype.slice.call(arguments,1);
235+
}
233236
deferred.resolve(result);
234237
}
235238
else {

tests/unit/utils.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ describe('$firebaseUtils', function () {
203203
expect(deferred.reject).toHaveBeenCalledWith(false);
204204
});
205205

206+
it('should aggregate multiple args into an array', function(){
207+
var result1 = {data:'hello world!'};
208+
var result2 = {data:'howdy!'};
209+
callback(null,result1,result2);
210+
expect(deferred.resolve).toHaveBeenCalledWith([result1,result2]);
211+
});
212+
206213
it('should resolve the promise if the first argument is falsy', function(){
207214
var result = {data:'hello world'};
208215
callback(null,result);

0 commit comments

Comments
 (0)