Updated script that can be controled by Nodejs web app
This commit is contained in:
3
node_modules/parseqs/.npmignore
generated
vendored
Normal file
3
node_modules/parseqs/.npmignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
npm-debug.log
|
21
node_modules/parseqs/LICENSE
generated
vendored
Normal file
21
node_modules/parseqs/LICENSE
generated
vendored
Normal file
@ -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.
|
3
node_modules/parseqs/Makefile
generated
vendored
Normal file
3
node_modules/parseqs/Makefile
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
test:
|
||||
@./node_modules/.bin/mocha test.js
|
1
node_modules/parseqs/README.md
generated
vendored
Normal file
1
node_modules/parseqs/README.md
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
Provides methods for converting an object into string representation, and vice versa.
|
37
node_modules/parseqs/index.js
generated
vendored
Normal file
37
node_modules/parseqs/index.js
generated
vendored
Normal file
@ -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;
|
||||
};
|
22
node_modules/parseqs/package.json
generated
vendored
Normal file
22
node_modules/parseqs/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "parseqs",
|
||||
"version": "0.0.5",
|
||||
"description": "Provides methods for parsing a query string into an object, and vice versa.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/get/querystring.git"
|
||||
},
|
||||
"homepage": "https://github.com/get/querystring",
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "1.17.1",
|
||||
"better-assert": "~1.0.0"
|
||||
},
|
||||
"author": "Gal Koren",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
}
|
27
node_modules/parseqs/test.js
generated
vendored
Normal file
27
node_modules/parseqs/test.js
generated
vendored
Normal file
@ -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');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user