}
Buffer.concat = function (list, totalLength) {
- if (!Array.isArray(list)) {
+ if (!isArray(list)) {
throw new Error('Usage: Buffer.concat(list, [totalLength])\n' +
'list should be an Array.')
}
return length < 0 ? 0 : length
}
+function isArray (subject) {
+ return (Array.isArray || function (subject) {
+ Object.toString.apply(subject) === '[object Array]'
+ })(subject)
+}
+
function isArrayIsh (subject) {
- return Array.isArray(subject) || Buffer.isBuffer(subject) ||
+ return isArray(subject) || Buffer.isBuffer(subject) ||
subject && typeof subject === 'object' &&
typeof subject.length === 'number'
}