Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "qq", | ||
"description": "A heavy-weight library for promises, based on Q", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "http://github.com/kriskowal/qq/", | ||
@@ -6,0 +6,0 @@ "author": "Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)", |
26
qq.js
@@ -204,24 +204,15 @@ (function (require, exports) { | ||
return object; | ||
} else if (Array.isArray(object)) { | ||
return reduceLeft(object, function (values, value) { | ||
return Q.when(deep(value), function (value) { | ||
return values.concat([value]); | ||
}); | ||
}, []); | ||
} else { | ||
var result = {}; | ||
var synchronize; | ||
for (var name in object) { | ||
if (has.call(object, name)) { | ||
(function (name, value) { | ||
synchronize = Q.when(synchronize, function () { | ||
return Q.when(deep(value), function (value) { | ||
result[name] = value; | ||
}); | ||
for (var i in object) { | ||
(function (i, value) { | ||
synchronize = Q.when(synchronize, function () { | ||
return Q.when(deep(value), function (value) { | ||
object[i] = value; | ||
}); | ||
})(name, object[name]); | ||
} | ||
}); | ||
})(i, object[i]); | ||
} | ||
return Q.when(synchronize, function () { | ||
return result; | ||
return object; | ||
}); | ||
@@ -232,2 +223,3 @@ } | ||
/** | ||
@@ -234,0 +226,0 @@ * The reduce methods all have the signature of `reduce` on |
@@ -23,4 +23,13 @@ | ||
exports['test deep'] = function (ASSERT, done) { | ||
var before = [{"a": Q.ref(10)}, Q.ref(20)]; | ||
Q.when(Q.deep(before), function (after) { | ||
ASSERT.ok(before === after, 'array modified in place'); | ||
ASSERT.ok(before[0] === after[0], 'object modified in place'); | ||
ASSERT.deepEqual(after, [{"a": 10}, 20], 'deeply equal afterward'); | ||
}).then(done, done); | ||
}; | ||
if (module == require.main) | ||
require('test').run(exports) | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20682
362