init
This commit is contained in:
13
node_modules/js-string-escape/CHANGELOG.md
generated
vendored
Normal file
13
node_modules/js-string-escape/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# master
|
||||
|
||||
# 1.0.1
|
||||
|
||||
* Exclude unused files from npm distribution
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* No change; version bumped to indicate that this package is considered stable
|
||||
|
||||
# 0.0.1
|
||||
|
||||
* Initial release
|
21
node_modules/js-string-escape/LICENSE
generated
vendored
Normal file
21
node_modules/js-string-escape/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Jo Liss
|
||||
|
||||
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.
|
44
node_modules/js-string-escape/README.md
generated
vendored
Normal file
44
node_modules/js-string-escape/README.md
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# js-string-escape
|
||||
|
||||
[](https://travis-ci.org/joliss/js-string-escape)
|
||||
|
||||
Escape any string to be a valid JavaScript string literal between double
|
||||
quotes or single quotes.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install js-string-escape
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
If you need to generate JavaScript output, this library will help you safely
|
||||
put arbitrary data in JavaScript strings:
|
||||
|
||||
```js
|
||||
jsStringEscape = require('js-string-escape')
|
||||
|
||||
console.log('"' + jsStringEscape('Quotes (\", \'), newlines (\n), etc.') + '"')
|
||||
// => "Quotes (\", \'), newlines (\n), etc."
|
||||
```
|
||||
|
||||
In other words, given any string `s`, the following invariants hold:
|
||||
|
||||
```js
|
||||
eval('"' + jsStringEscape(s) + '"') === s
|
||||
eval("'" + jsStringEscape(s) + "'") === s
|
||||
```
|
||||
|
||||
These `eval` expressions are safe with untrusted strings `s`.
|
||||
|
||||
Non-strings will be cast to strings.
|
||||
|
||||
## Compliance
|
||||
|
||||
This library has been checked against [ECMAScript
|
||||
5.1](http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4) and tested
|
||||
against all Unicode code points.
|
||||
|
||||
Note that the returned string is not necessarily valid JSON, since JSON
|
||||
disallows control characters, and `\'` is illegal in JSON.
|
22
node_modules/js-string-escape/index.js
generated
vendored
Normal file
22
node_modules/js-string-escape/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = function (string) {
|
||||
return ('' + string).replace(/["'\\\n\r\u2028\u2029]/g, function (character) {
|
||||
// Escape all characters not included in SingleStringCharacters and
|
||||
// DoubleStringCharacters on
|
||||
// http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
|
||||
switch (character) {
|
||||
case '"':
|
||||
case "'":
|
||||
case '\\':
|
||||
return '\\' + character
|
||||
// Four possible LineTerminator characters need to be escaped:
|
||||
case '\n':
|
||||
return '\\n'
|
||||
case '\r':
|
||||
return '\\r'
|
||||
case '\u2028':
|
||||
return '\\u2028'
|
||||
case '\u2029':
|
||||
return '\\u2029'
|
||||
}
|
||||
})
|
||||
}
|
38
node_modules/js-string-escape/package.json
generated
vendored
Normal file
38
node_modules/js-string-escape/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "js-string-escape",
|
||||
"version": "1.0.1",
|
||||
"description": "Escape strings for use as JavaScript string literals",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/joliss/js-string-escape"
|
||||
},
|
||||
"keywords": [
|
||||
"string",
|
||||
"escape",
|
||||
"backslash",
|
||||
"javascript",
|
||||
"ecmascript"
|
||||
],
|
||||
"author": "Jo Liss <joliss42@gmail.com>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"url": "http://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies" : {
|
||||
"tap": "~> 0.4.2",
|
||||
"punycode": "~> 1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user