Updated script that can be controled by Nodejs web app
This commit is contained in:
2
node_modules/parsejson/.npmignore
generated
vendored
Normal file
2
node_modules/parsejson/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.DS_Store
|
||||
node_modules
|
21
node_modules/parsejson/LICENSE
generated
vendored
Normal file
21
node_modules/parsejson/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/parsejson/Makefile
generated
vendored
Normal file
3
node_modules/parsejson/Makefile
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
test:
|
||||
@./node_modules/.bin/mocha test.js
|
2
node_modules/parsejson/README.md
generated
vendored
Normal file
2
node_modules/parsejson/README.md
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# parsejson
|
||||
engine.io-client JSON-parsing module
|
32
node_modules/parsejson/index.js
generated
vendored
Normal file
32
node_modules/parsejson/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* JSON parse.
|
||||
*
|
||||
* @see Based on jQuery#parseJSON (MIT) and JSON2
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var rvalidchars = /^[\],:{}\s]*$/;
|
||||
var rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
|
||||
var rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
|
||||
var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;
|
||||
var rtrimLeft = /^\s+/;
|
||||
var rtrimRight = /\s+$/;
|
||||
|
||||
module.exports = function parsejson(data) {
|
||||
if ('string' != typeof data || !data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
data = data.replace(rtrimLeft, '').replace(rtrimRight, '');
|
||||
|
||||
// Attempt to parse using the native JSON parser first
|
||||
if (global.JSON && JSON.parse) {
|
||||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
if (rvalidchars.test(data.replace(rvalidescape, '@')
|
||||
.replace(rvalidtokens, ']')
|
||||
.replace(rvalidbraces, ''))) {
|
||||
return (new Function('return ' + data))();
|
||||
}
|
||||
};
|
22
node_modules/parsejson/package.json
generated
vendored
Normal file
22
node_modules/parsejson/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "parsejson",
|
||||
"version": "0.0.3",
|
||||
"description": "Method that parses a JSON string and returns a JSON object",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/get/parsejson.git"
|
||||
},
|
||||
"homepage": "https://github.com/get/parsejson",
|
||||
"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"
|
||||
}
|
||||
}
|
21
node_modules/parsejson/test.js
generated
vendored
Normal file
21
node_modules/parsejson/test.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
var assert = require('better-assert');
|
||||
var expect = require('expect.js');
|
||||
var parsejson = require('./index.js');
|
||||
|
||||
describe('my suite', function(){
|
||||
it('should parse a JSON string', function () {
|
||||
|
||||
var jsonString = '{"users" :[{"first_name":"foo", "last_name":"bar"}],' +
|
||||
'"id" :40,' +
|
||||
'"cities":["los angeles", "new york", "boston"]}';
|
||||
|
||||
var jsonObj = parsejson(jsonString);
|
||||
expect(jsonObj.users[0].first_name).to.be("foo");
|
||||
expect(jsonObj.users[0].last_name).to.be("bar");
|
||||
expect(jsonObj.id).to.be(40);
|
||||
expect(jsonObj.cities[0]).to.be('los angeles');
|
||||
expect(jsonObj.cities[1]).to.be('new york');
|
||||
expect(jsonObj.cities[2]).to.be('boston');
|
||||
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user