Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

util.isArray doesn't exist in node < v0.6 #3

Merged
merged 1 commit into from

2 participants

@twobit

At Yahoo we use v0.4.13 which doesn't have util.isArray:
https://github.com/joyent/node/wiki/API-changes-between-v0.4-and-v0.6

I added a check for util.isArray, if it doesn't exist we define it. I use the same isArray from node source:
https://github.com/joyent/node/blob/master/lib/util.js#L380

@mosen
Owner

Hey there,

Sorry I was developing against 0.6 but theres no real reason to use that API exclusively. Hopefully i'll integrate YUI's own Array object into these kind of things which will give us something more platform agnostic :)

@mosen mosen merged commit 5581924 into mosen:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 2, 2012
  1. @twobit
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/buildy/queue.js
View
12 lib/buildy/queue.js
@@ -6,7 +6,13 @@ var util = require('util')
, events = require('events')
, winston = require('winston')
, Registry = require('./registry')
- , State = require('./state');
+ , State = require('./state')
+ , isArray = util.isArray || function(ar) {
+ return Array.isArray(ar) ||
+ (typeof ar === 'object' && objectToString(ar) === '[object Array]');
+ };
+
+
/**
*
@@ -111,7 +117,7 @@ var Queue = module.exports = function Queue(name, options) {
* @default []
* @private
*/
- this._skip = util.isArray(options.skip) ? options.skip : [];
+ this._skip = isArray(options.skip) ? options.skip : [];
/**
* Task default parameters.
@@ -376,4 +382,4 @@ Queue.prototype._onTaskFailed = function(type, result) {
task : this._queue[this._queuePosition],
result: result
});
-};
+};
Something went wrong with that request. Please try again.