[Pkg-javascript-commits] [node-async] 352/480: Passing an object to .series() may lead to unexpected behavior
Jonas Smedegaard
js at moszumanska.debian.org
Fri May 2 08:58:41 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-async.
commit 93c536b3abef27d08f4f6dc89edb93e338e3656d
Author: Kevin van Zonneveld <kevin at transloadit.com>
Date: Mon Oct 14 18:42:33 2013 +0200
Passing an object to .series() may lead to unexpected behavior
Just a friendly reminder for devs that pass an object to `series()`.
There are platforms that will execute the functions in seemingly
random order. If you or your testsuite rely on order of execution,
it's better to just use an array of functions.
---
README.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/README.md b/README.md
index 31cfbab..00f326b 100644
--- a/README.md
+++ b/README.md
@@ -594,6 +594,14 @@ run as a function and the results will be passed to the final callback as an obj
instead of an array. This can be a more readable way of handling results from
async.series.
+**Note** that while many implementations preserve the order of object properties, the
+[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
+explicitly states that
+
+> The mechanics and order of enumerating the properties is not specified.
+
+So if you rely on the order in which your series of functions are executed, and want
+this to work on all platforms, consider using an array.
__Arguments__
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git
More information about the Pkg-javascript-commits
mailing list