From b60df56157ee1fd0bd4938799bac05a62fda91a1 Mon Sep 17 00:00:00 2001 From: lookshe Date: Sat, 14 Mar 2015 20:45:20 +0100 Subject: initial commit from working version --- .../components/timoxley-to-array/component.json | 16 +++++++++++++ .../components/timoxley-to-array/index.js | 27 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/component.json create mode 100644 signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/index.js (limited to 'signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array') diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/component.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/component.json new file mode 100644 index 0000000..e6a77fe --- /dev/null +++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/component.json @@ -0,0 +1,16 @@ +{ + "name": "to-array", + "repo": "timoxley/to-array", + "description": "Convert an array-like object into an Array.", + "version": "0.1.4", + "keywords": [], + "dependencies": {}, + "development": { + "timoxley/assert": "*", + "component/domify": "*" + }, + "license": "MIT", + "scripts": [ + "index.js" + ] +} \ No newline at end of file diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/index.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/index.js new file mode 100644 index 0000000..cc495d6 --- /dev/null +++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/timoxley-to-array/index.js @@ -0,0 +1,27 @@ +/** + * Convert an array-like object into an `Array`. + * If `collection` is already an `Array`, then will return a clone of `collection`. + * + * @param {Array | Mixed} collection An `Array` or array-like object to convert e.g. `arguments` or `NodeList` + * @return {Array} Naive conversion of `collection` to a new `Array`. + * @api private + */ + +module.exports = function toArray(collection) { + if (typeof collection === 'undefined') return [] + if (collection === null) return [null] + if (collection === window) return [window] + if (typeof collection === 'string') return [collection] + if (Array.isArray(collection)) return collection.slice() + if (typeof collection.length != 'number') return [collection] + if (typeof collection === 'function') return [collection] + + var arr = [] + for (var i = 0; i < collection.length; i++) { + if (collection.hasOwnProperty(i) || i in collection) { + arr.push(collection[i]) + } + } + if (!arr.length) return [] + return arr +} -- cgit v1.2.3