implemented basic client-server communication
This commit is contained in:
		
							
								
								
									
										21
									
								
								node_modules/array-flatten/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/array-flatten/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in
 | 
			
		||||
all copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
THE SOFTWARE.
 | 
			
		||||
							
								
								
									
										43
									
								
								node_modules/array-flatten/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								node_modules/array-flatten/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
# Array Flatten
 | 
			
		||||
 | 
			
		||||
[![NPM version][npm-image]][npm-url]
 | 
			
		||||
[![NPM downloads][downloads-image]][downloads-url]
 | 
			
		||||
[![Build status][travis-image]][travis-url]
 | 
			
		||||
[![Test coverage][coveralls-image]][coveralls-url]
 | 
			
		||||
 | 
			
		||||
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
npm install array-flatten --save
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
var flatten = require('array-flatten')
 | 
			
		||||
 | 
			
		||||
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
 | 
			
		||||
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
 | 
			
		||||
 | 
			
		||||
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
 | 
			
		||||
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
 | 
			
		||||
 | 
			
		||||
(function () {
 | 
			
		||||
  flatten(arguments) //=> [1, 2, 3]
 | 
			
		||||
})(1, [2, 3])
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
MIT
 | 
			
		||||
 | 
			
		||||
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
 | 
			
		||||
[npm-url]: https://npmjs.org/package/array-flatten
 | 
			
		||||
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
 | 
			
		||||
[downloads-url]: https://npmjs.org/package/array-flatten
 | 
			
		||||
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
 | 
			
		||||
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
 | 
			
		||||
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
 | 
			
		||||
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
 | 
			
		||||
							
								
								
									
										64
									
								
								node_modules/array-flatten/array-flatten.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								node_modules/array-flatten/array-flatten.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expose `arrayFlatten`.
 | 
			
		||||
 */
 | 
			
		||||
module.exports = arrayFlatten
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Recursive flatten function with depth.
 | 
			
		||||
 *
 | 
			
		||||
 * @param  {Array}  array
 | 
			
		||||
 * @param  {Array}  result
 | 
			
		||||
 * @param  {Number} depth
 | 
			
		||||
 * @return {Array}
 | 
			
		||||
 */
 | 
			
		||||
function flattenWithDepth (array, result, depth) {
 | 
			
		||||
  for (var i = 0; i < array.length; i++) {
 | 
			
		||||
    var value = array[i]
 | 
			
		||||
 | 
			
		||||
    if (depth > 0 && Array.isArray(value)) {
 | 
			
		||||
      flattenWithDepth(value, result, depth - 1)
 | 
			
		||||
    } else {
 | 
			
		||||
      result.push(value)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Recursive flatten function. Omitting depth is slightly faster.
 | 
			
		||||
 *
 | 
			
		||||
 * @param  {Array} array
 | 
			
		||||
 * @param  {Array} result
 | 
			
		||||
 * @return {Array}
 | 
			
		||||
 */
 | 
			
		||||
function flattenForever (array, result) {
 | 
			
		||||
  for (var i = 0; i < array.length; i++) {
 | 
			
		||||
    var value = array[i]
 | 
			
		||||
 | 
			
		||||
    if (Array.isArray(value)) {
 | 
			
		||||
      flattenForever(value, result)
 | 
			
		||||
    } else {
 | 
			
		||||
      result.push(value)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Flatten an array, with the ability to define a depth.
 | 
			
		||||
 *
 | 
			
		||||
 * @param  {Array}  array
 | 
			
		||||
 * @param  {Number} depth
 | 
			
		||||
 * @return {Array}
 | 
			
		||||
 */
 | 
			
		||||
function arrayFlatten (array, depth) {
 | 
			
		||||
  if (depth == null) {
 | 
			
		||||
    return flattenForever(array, [])
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return flattenWithDepth(array, [], depth)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										39
									
								
								node_modules/array-flatten/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								node_modules/array-flatten/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "array-flatten",
 | 
			
		||||
  "version": "1.1.1",
 | 
			
		||||
  "description": "Flatten an array of nested arrays into a single flat array",
 | 
			
		||||
  "main": "array-flatten.js",
 | 
			
		||||
  "files": [
 | 
			
		||||
    "array-flatten.js",
 | 
			
		||||
    "LICENSE"
 | 
			
		||||
  ],
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "istanbul cover _mocha -- -R spec"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git://github.com/blakeembrey/array-flatten.git"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "array",
 | 
			
		||||
    "flatten",
 | 
			
		||||
    "arguments",
 | 
			
		||||
    "depth"
 | 
			
		||||
  ],
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Blake Embrey",
 | 
			
		||||
    "email": "hello@blakeembrey.com",
 | 
			
		||||
    "url": "http://blakeembrey.me"
 | 
			
		||||
  },
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/blakeembrey/array-flatten/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/blakeembrey/array-flatten",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "istanbul": "^0.3.13",
 | 
			
		||||
    "mocha": "^2.2.4",
 | 
			
		||||
    "pre-commit": "^1.0.7",
 | 
			
		||||
    "standard": "^3.7.3"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user