Initial commit
This commit is contained in:
13
node_modules/js-stringify/.npmignore
generated
vendored
Normal file
13
node_modules/js-stringify/.npmignore
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
pids
|
||||
logs
|
||||
results
|
||||
npm-debug.log
|
||||
node_modules
|
3
node_modules/js-stringify/.travis.yml
generated
vendored
Normal file
3
node_modules/js-stringify/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
19
node_modules/js-stringify/LICENSE
generated
vendored
Normal file
19
node_modules/js-stringify/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014 Forbes Lindesay
|
||||
|
||||
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.
|
34
node_modules/js-stringify/README.md
generated
vendored
Normal file
34
node_modules/js-stringify/README.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# js-stringify
|
||||
|
||||
Stringify an object so it can be safely inlined in JavaScript code
|
||||
|
||||
[](https://travis-ci.org/jadejs/js-stringify)
|
||||
[](https://gemnasium.com/jadejs/js-stringify)
|
||||
[](https://www.npmjs.org/package/js-stringify)
|
||||
|
||||
## Installation
|
||||
|
||||
npm install js-stringify
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
|
||||
var assert = require('assert');
|
||||
var stringify = require('js-stringify');
|
||||
|
||||
assert(stringify('foo') === '"foo"');
|
||||
assert(stringify('foo\u2028bar\u2029baz') === '"foo\\u2028bar\\u2029baz"');
|
||||
assert(stringify(new Date('2014-12-19T03:42:00.000Z')) === 'new Date("2014-12-19T03:42:00.000Z")');
|
||||
assert(stringify({foo: 'bar'}) === '{"foo":"bar"}');
|
||||
assert(stringify(undefined) === 'undefined');
|
||||
assert(stringify(null) === 'null');
|
||||
assert(
|
||||
stringify({val: "</script><script>alert('bad actor')</script>"}) ===
|
||||
'{"val":"\\u003C\\u002Fscript\\u003E\\u003Cscript\\u003Ealert(\'bad actor\')\\u003C\\u002Fscript\\u003E"}'
|
||||
);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
17
node_modules/js-stringify/index.js
generated
vendored
Normal file
17
node_modules/js-stringify/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = stringify;
|
||||
function stringify(obj) {
|
||||
if (obj instanceof Date) {
|
||||
return 'new Date(' + stringify(obj.toISOString()) + ')';
|
||||
}
|
||||
if (obj === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
return JSON.stringify(obj)
|
||||
.replace(/\u2028/g, '\\u2028')
|
||||
.replace(/\u2029/g, '\\u2029')
|
||||
.replace(/</g, '\\u003C')
|
||||
.replace(/>/g, '\\u003E')
|
||||
.replace(/\//g, '\\u002F');
|
||||
}
|
17
node_modules/js-stringify/package.json
generated
vendored
Normal file
17
node_modules/js-stringify/package.json
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "js-stringify",
|
||||
"version": "1.0.2",
|
||||
"description": "Stringify an object so it can be safely inlined in JavaScript code",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jadejs/js-stringify.git"
|
||||
},
|
||||
"author": "ForbesLindesay",
|
||||
"license": "MIT"
|
||||
}
|
17
node_modules/js-stringify/test/index.js
generated
vendored
Normal file
17
node_modules/js-stringify/test/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
var stringify = require('../');
|
||||
|
||||
assert(stringify('foo') === '"foo"');
|
||||
assert(stringify('foo\u2028bar\u2029baz') === '"foo\\u2028bar\\u2029baz"');
|
||||
assert(stringify(new Date('2014-12-19T03:42:00.000Z')) === 'new Date("2014-12-19T03:42:00.000Z")');
|
||||
assert(stringify({foo: 'bar'}) === '{"foo":"bar"}');
|
||||
assert(stringify(undefined) === 'undefined');
|
||||
assert(stringify(null) === 'null');
|
||||
assert(
|
||||
stringify({val: "</script><script>alert('bad actor')</script>"}) ===
|
||||
'{"val":"\\u003C\\u002Fscript\\u003E\\u003Cscript\\u003Ealert(\'bad actor\')\\u003C\\u002Fscript\\u003E"}'
|
||||
);
|
||||
|
||||
console.log('tests passed');
|
Reference in New Issue
Block a user