diff options
| author | Yaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx> | 2017-11-29 11:44:34 +0300 | 
|---|---|---|
| committer | Yaroslav De La Peña Smirnov <yaros.rus_89@live.com.mx> | 2017-11-29 11:44:34 +0300 | 
| commit | 67fdec20726e48ba3a934cb25bb30d47ec4a4f29 (patch) | |
| tree | 37fd9f4f0b0c20103e1646fc83021e4765de3680 /node_modules/parseqs | |
| download | spanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.tar.gz spanish-checkers-67fdec20726e48ba3a934cb25bb30d47ec4a4f29.zip  | |
Initial commit, version 0.5.3
Diffstat (limited to 'node_modules/parseqs')
| -rw-r--r-- | node_modules/parseqs/.npmignore | 3 | ||||
| -rw-r--r-- | node_modules/parseqs/LICENSE | 21 | ||||
| -rw-r--r-- | node_modules/parseqs/Makefile | 3 | ||||
| -rw-r--r-- | node_modules/parseqs/README.md | 1 | ||||
| -rw-r--r-- | node_modules/parseqs/index.js | 37 | ||||
| -rw-r--r-- | node_modules/parseqs/package.json | 88 | ||||
| -rw-r--r-- | node_modules/parseqs/test.js | 27 | 
7 files changed, 180 insertions, 0 deletions
diff --git a/node_modules/parseqs/.npmignore b/node_modules/parseqs/.npmignore new file mode 100644 index 0000000..0c3454b --- /dev/null +++ b/node_modules/parseqs/.npmignore @@ -0,0 +1,3 @@ +.DS_Store +node_modules +npm-debug.log
\ No newline at end of file diff --git a/node_modules/parseqs/LICENSE b/node_modules/parseqs/LICENSE new file mode 100644 index 0000000..852cee8 --- /dev/null +++ b/node_modules/parseqs/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Gal Koren + +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. diff --git a/node_modules/parseqs/Makefile b/node_modules/parseqs/Makefile new file mode 100644 index 0000000..1d90629 --- /dev/null +++ b/node_modules/parseqs/Makefile @@ -0,0 +1,3 @@ + +test: +	@./node_modules/.bin/mocha test.js diff --git a/node_modules/parseqs/README.md b/node_modules/parseqs/README.md new file mode 100644 index 0000000..5c03c55 --- /dev/null +++ b/node_modules/parseqs/README.md @@ -0,0 +1 @@ +Provides methods for converting an object into string representation, and vice versa. diff --git a/node_modules/parseqs/index.js b/node_modules/parseqs/index.js new file mode 100644 index 0000000..e0b366e --- /dev/null +++ b/node_modules/parseqs/index.js @@ -0,0 +1,37 @@ +/** + * Compiles a querystring + * Returns string representation of the object + * + * @param {Object} + * @api private + */ + +exports.encode = function (obj) { +  var str = ''; + +  for (var i in obj) { +    if (obj.hasOwnProperty(i)) { +      if (str.length) str += '&'; +      str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); +    } +  } + +  return str; +}; + +/** + * Parses a simple querystring into an object + * + * @param {String} qs + * @api private + */ + +exports.decode = function(qs){ +  var qry = {}; +  var pairs = qs.split('&'); +  for (var i = 0, l = pairs.length; i < l; i++) { +    var pair = pairs[i].split('='); +    qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); +  } +  return qry; +}; diff --git a/node_modules/parseqs/package.json b/node_modules/parseqs/package.json new file mode 100644 index 0000000..2ae270f --- /dev/null +++ b/node_modules/parseqs/package.json @@ -0,0 +1,88 @@ +{ +  "_args": [ +    [ +      { +        "raw": "parseqs@0.0.5", +        "scope": null, +        "escapedName": "parseqs", +        "name": "parseqs", +        "rawSpec": "0.0.5", +        "spec": "0.0.5", +        "type": "version" +      }, +      "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/socket.io-client" +    ] +  ], +  "_from": "parseqs@0.0.5", +  "_id": "parseqs@0.0.5", +  "_inCache": true, +  "_location": "/parseqs", +  "_nodeVersion": "6.9.1", +  "_npmOperationalInternal": { +    "host": "packages-18-east.internal.npmjs.com", +    "tmp": "tmp/parseqs-0.0.5.tgz_1477582844598_0.35737923183478415" +  }, +  "_npmUser": { +    "name": "gal", +    "email": "koren@mit.edu" +  }, +  "_npmVersion": "3.10.8", +  "_phantomChildren": {}, +  "_requested": { +    "raw": "parseqs@0.0.5", +    "scope": null, +    "escapedName": "parseqs", +    "name": "parseqs", +    "rawSpec": "0.0.5", +    "spec": "0.0.5", +    "type": "version" +  }, +  "_requiredBy": [ +    "/engine.io-client", +    "/socket.io-client" +  ], +  "_resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", +  "_shasum": "d5208a3738e46766e291ba2ea173684921a8b89d", +  "_shrinkwrap": null, +  "_spec": "parseqs@0.0.5", +  "_where": "/mnt/e/Yaroslav/Documents/Webs/nodejs/checkers/node_modules/socket.io-client", +  "author": { +    "name": "Gal Koren" +  }, +  "bugs": { +    "url": "https://github.com/get/querystring/issues" +  }, +  "dependencies": { +    "better-assert": "~1.0.0" +  }, +  "description": "Provides methods for parsing a query string into an object, and vice versa.", +  "devDependencies": { +    "better-assert": "~1.0.0", +    "mocha": "1.17.1" +  }, +  "directories": {}, +  "dist": { +    "shasum": "d5208a3738e46766e291ba2ea173684921a8b89d", +    "tarball": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz" +  }, +  "gitHead": "4d037fc0625fb72eec9394724e18f29e0a946af5", +  "homepage": "https://github.com/get/querystring", +  "license": "MIT", +  "maintainers": [ +    { +      "name": "gal", +      "email": "koren@mit.edu" +    } +  ], +  "name": "parseqs", +  "optionalDependencies": {}, +  "readme": "ERROR: No README data found!", +  "repository": { +    "type": "git", +    "url": "git+https://github.com/get/querystring.git" +  }, +  "scripts": { +    "test": "make test" +  }, +  "version": "0.0.5" +} diff --git a/node_modules/parseqs/test.js b/node_modules/parseqs/test.js new file mode 100644 index 0000000..2ccb925 --- /dev/null +++ b/node_modules/parseqs/test.js @@ -0,0 +1,27 @@ +var assert = require('better-assert'); +var expect = require('expect.js'); +var util = require('./index.js'); + +describe('querystring test suite', function(){ +	it('should parse a querystring and return an object', function () { +		 +		// Single assignment +		var queryObj = util.decode("foo=bar"); +		expect(queryObj.foo).to.be("bar"); +		 +		// Multiple assignments +		queryObj = util.decode("france=paris&germany=berlin"); +		expect(queryObj.france).to.be("paris"); +		expect(queryObj.germany).to.be("berlin"); +		 +		// Assignments containing non-alphanumeric characters +		queryObj = util.decode("india=new%20delhi"); +		expect(queryObj.india).to.be("new delhi"); +	}); +	 +	it('should construct a query string from an object', function () { +		expect(util.encode({ a: 'b' })).to.be('a=b'); +		expect(util.encode({ a: 'b', c: 'd' })).to.be('a=b&c=d'); +		expect(util.encode({ a: 'b', c: 'tobi rocks' })).to.be('a=b&c=tobi%20rocks'); +	}); +});  | 
