![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package nodejs-async for openSUSE:Factory checked in at 2015-06-30 10:16:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-async (Old) and /work/SRC/openSUSE:Factory/.nodejs-async.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "nodejs-async" Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-async/nodejs-async.changes 2015-04-27 13:00:02.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-async.new/nodejs-async.changes 2015-06-30 10:16:54.000000000 +0200 @@ -1,0 +2,5 @@ +Fri Jun 26 17:10:12 UTC 2015 - i@marguerite.su + +- update version 0.9.2 + +------------------------------------------------------------------- Old: ---- async-0.9.0.tgz New: ---- async-0.9.2.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-async.spec ++++++ --- /var/tmp/diff_new_pack.5jJxuI/_old 2015-06-30 10:16:55.000000000 +0200 +++ /var/tmp/diff_new_pack.5jJxuI/_new 2015-06-30 10:16:55.000000000 +0200 @@ -19,7 +19,7 @@ %define base_name async Name: nodejs-async -Version: 0.9.0 +Version: 0.9.2 Release: 0 Summary: Higher-order functions and common patterns for asynchronous code License: MIT @@ -43,7 +43,7 @@ %install mkdir -p %{buildroot}%{nodejs_modulesdir}/%{base_name} -cp -pr *.json lib \ +cp -pr *.json lib support \ %{buildroot}%{nodejs_modulesdir}/%{base_name}/ %files ++++++ async-0.9.0.tgz -> async-0.9.2.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/.travis.yml new/package/.travis.yml --- old/package/.travis.yml 2014-03-30 12:42:31.000000000 +0200 +++ new/package/.travis.yml 2015-05-19 10:44:23.000000000 +0200 @@ -1,3 +1,5 @@ language: node_js node_js: - "0.10" + - "0.12" + - "iojs" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/README.md new/package/README.md --- old/package/README.md 2014-05-16 12:20:03.000000000 +0200 +++ new/package/README.md 2015-05-19 10:44:23.000000000 +0200 @@ -5,8 +5,16 @@ Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for -use with [Node.js](http://nodejs.org), it can also be used directly in the -browser. Also supports [component](https://github.com/component/component). +use with [Node.js](http://nodejs.org) and installable via `npm install async`, +it can also be used directly in the browser. + +Async is also installable via: + +- [bower](http://bower.io/): `bower install async` +- [component](https://github.com/component/component): `component install + caolan/async` +- [jam](http://jamjs.org/): `jam install async` +- [spm](http://spmjs.io/): `spm install async` Async provides around 20 functions that include the usual 'functional' suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns @@ -182,7 +190,7 @@ * `arr` - An array to iterate over. * `iterator(item, callback)` - A function to apply to each item in `arr`. The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the `callback` should be run without + completed. If no error has occurred, the `callback` should be run without arguments or with an explicit `null` argument. * `callback(err)` - A callback which is called when all `iterator` functions have finished, or an error occurs. @@ -202,7 +210,7 @@ ```js // assuming openFiles is an array of file names -async.each(openFiles, function( file, callback) { +async.each(openFiles, function(file, callback) { // Perform operation on file here. console.log('Processing file ' + file); @@ -256,7 +264,7 @@ * `limit` - The maximum number of `iterator`s to run at any time. * `iterator(item, callback)` - A function to apply to each item in `arr`. The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the callback should be run without + completed. If no error has occurred, the callback should be run without arguments or with an explicit `null` argument. * `callback(err)` - A callback which is called when all `iterator` functions have finished, or an error occurs. @@ -280,7 +288,7 @@ Produces a new array of values by mapping each value in `arr` through the `iterator` function. The `iterator` is called with an item from `arr` and a callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to this +an `error`, and the transformed item from `arr`. If `iterator` passes an error to his callback, the main `callback` (for the `map` function) is immediately called with the error. Note, that since this function applies the `iterator` to each item in parallel, @@ -536,14 +544,14 @@ ```js //ascending order async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x); + callback(null, x); }, function(err,result){ //result callback } ); //descending order async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x*-1); //<- x*-1 instead of x, turns the order around + callback(null, x*-1); //<- x*-1 instead of x, turns the order around }, function(err,result){ //result callback } ); @@ -913,19 +921,19 @@ ```js async.waterfall([ - function(callback){ + function(callback) { callback(null, 'one', 'two'); }, - function(arg1, arg2, callback){ + function(arg1, arg2, callback) { // arg1 now equals 'one' and arg2 now equals 'two' callback(null, 'three'); }, - function(arg1, callback){ + function(arg1, callback) { // arg1 now equals 'three' callback(null, 'done'); } ], function (err, result) { - // result now equals 'done' + // result now equals 'done' }); ``` @@ -972,7 +980,8 @@ ### seq(fn1, fn2...) Version of the compose function that is more natural to read. -Each following function consumes the return value of the latter function. +Each function consumes the return value of the previous function. +It is the equivalent of [`compose`](#compose) with the arguments reversed. Each function is executed with the `this` binding of the composed function. @@ -989,28 +998,20 @@ // This example uses `seq` function to avoid overnesting and error // handling clutter. app.get('/cats', function(request, response) { - function handleError(err, data, callback) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } - else { - callback(data); - } - } var User = request.models.User; async.seq( _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - handleError, function(user, fn) { user.getCats(fn); // 'getCats' has signature (callback(err, data)) - }, - handleError, - function(cats) { + } + )(req.session.user_id, function (err, cats) { + if (err) { + console.error(err); + response.json({ status: 'error', message: err.message }); + } else { response.json({ status: 'ok', message: 'Cats found', data: cats }); } - )(req.session.user_id); - } + }); }); ``` @@ -1092,7 +1093,7 @@ * `paused` - a boolean for determining whether the queue is in a paused state * `pause()` - a function that pauses the processing of tasks until `resume()` is called. * `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle. +* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle. __Example__ @@ -1122,7 +1123,7 @@ // add some items to the queue (batch-wise) q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); + console.log('finished processing item'); }); // add some items to the front of the queue @@ -1349,7 +1350,7 @@ Attempts to get a successful response from `task` no more than `times` times before returning an error. If the task is successful, the `callback` will be passed the result -of the successfull task. If all attemps fail, the callback will be passed the error and +of the successful task. If all attempts fail, the callback will be passed the error and result (if any) of the final attempt. __Arguments__ @@ -1474,7 +1475,7 @@ --------------------------------------- <a name="nextTick" /> -### nextTick(callback) +### nextTick(callback), setImmediate(callback) Calls `callback` on a later loop around the event loop. In Node.js this just calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/bower.json new/package/bower.json --- old/package/bower.json 1970-01-01 01:00:00.000000000 +0100 +++ new/package/bower.json 2015-05-19 10:44:23.000000000 +0200 @@ -0,0 +1,38 @@ +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "version": "0.9.2", + "main": "lib/async.js", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/caolan/async.git" + }, + "devDependencies": { + "nodeunit": ">0.0.0", + "uglify-js": "1.2.x", + "nodelint": ">0.0.0", + "lodash": ">=2.4.1" + }, + "moduleType": [ + "amd", + "globals", + "node" + ], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "authors": [ + "Caolan McMahon" + ] +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/component.json new/package/component.json --- old/package/component.json 2014-03-30 12:42:31.000000000 +0200 +++ new/package/component.json 2015-05-19 10:44:23.000000000 +0200 @@ -1,11 +1,16 @@ { "name": "async", - "repo": "caolan/async", "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} + "version": "0.9.2", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "license": "MIT", + "repository": "caolan/async", + "scripts": [ + "lib/async.js" + ] +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/lib/async.js new/package/lib/async.js --- old/package/lib/async.js 2014-05-16 12:20:03.000000000 +0200 +++ new/package/lib/async.js 2015-05-19 10:44:23.000000000 +0200 @@ -42,9 +42,6 @@ }; var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } for (var i = 0; i < arr.length; i += 1) { iterator(arr[i], i, arr); } @@ -821,23 +818,26 @@ pause: function () { if (q.paused === true) { return; } q.paused = true; - q.process(); }, resume: function () { if (q.paused === false) { return; } q.paused = false; - q.process(); + // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= q.concurrency; w++) { + async.setImmediate(q.process); + } } }; return q; }; - + async.priorityQueue = function (worker, concurrency) { - + function _compareTasks(a, b){ return a.priority - b.priority; }; - + function _binarySearch(sequence, item, compare) { var beg = -1, end = sequence.length - 1; @@ -851,7 +851,7 @@ } return beg; } - + function _insert(q, data, priority, callback) { if (!q.started){ q.started = true; @@ -873,7 +873,7 @@ priority: priority, callback: typeof callback === 'function' ? callback : null }; - + q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); if (q.saturated && q.tasks.length === q.concurrency) { @@ -882,15 +882,15 @@ async.setImmediate(q.process); }); } - + // Start with a normal queue var q = async.queue(worker, concurrency); - + // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback); }; - + // Remove unshift function delete q.unshift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json --- old/package/package.json 2014-05-16 12:20:11.000000000 +0200 +++ new/package/package.json 2015-05-19 10:44:23.000000000 +0200 @@ -1,36 +1,54 @@ { - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./lib/async", - "author": "Caolan McMahon", - "version": "0.9.0", - "repository" : { - "type" : "git", - "url" : "https://github.com/caolan/async.git" - }, - "bugs" : { - "url" : "https://github.com/caolan/async/issues" - }, - "licenses" : [ - { - "type" : "MIT", - "url" : "https://github.com/caolan/async/raw/master/LICENSE" - } + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "main": "lib/async.js", + "author": "Caolan McMahon", + "version": "0.9.2", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "repository": { + "type": "git", + "url": "https://github.com/caolan/async.git" + }, + "bugs": { + "url": "https://github.com/caolan/async/issues" + }, + "license": "MIT", + "devDependencies": { + "nodeunit": ">0.0.0", + "uglify-js": "1.2.x", + "nodelint": ">0.0.0", + "lodash": ">=2.4.1" + }, + "jam": { + "main": "lib/async.js", + "include": [ + "lib/async.js", + "README.md", + "LICENSE" ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "jam": { - "main": "lib/async.js", - "include": [ - "lib/async.js", - "README.md", - "LICENSE" - ] - }, - "scripts": { - "test": "nodeunit test/test-async.js" - } -} + "categories": [ + "Utilities" + ] + }, + "scripts": { + "test": "nodeunit test/test-async.js" + }, + "spm": { + "main": "lib/async.js" + }, + "volo": { + "main": "lib/async.js", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] + } +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/support/sync-package-managers.js new/package/support/sync-package-managers.js --- old/package/support/sync-package-managers.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/support/sync-package-managers.js 2015-05-19 10:44:23.000000000 +0200 @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +// This should probably be its own module but complaints about bower/etc. +// support keep coming up and I'd rather just enable the workflow here for now +// and figure out where this should live later. -- @beaugunderson + +var fs = require('fs'); +var _ = require('lodash'); + +var packageJson = require('../package.json'); + +var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests']; +var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE']; +var REPOSITORY_NAME = 'caolan/async'; + +packageJson.jam = { + main: packageJson.main, + include: INCLUDES, + categories: ['Utilities'] +}; + +packageJson.spm = { + main: packageJson.main +}; + +packageJson.volo = { + main: packageJson.main, + ignore: IGNORES +}; + +var bowerSpecific = { + moduleType: ['amd', 'globals', 'node'], + ignore: IGNORES, + authors: [packageJson.author] +}; + +var bowerInclude = ['name', 'description', 'version', 'main', 'keywords', + 'license', 'homepage', 'repository', 'devDependencies']; + +var componentSpecific = { + repository: REPOSITORY_NAME, + scripts: [packageJson.main] +}; + +var componentInclude = ['name', 'description', 'version', 'keywords', + 'license']; + +var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific); +var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific); + +fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2)); +fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2)); +fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));