Socket
Socket
Sign inDemoInstall

jsesc

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsesc - npm Package Compare versions

Comparing version 0.4.3 to 0.5.0

21

jsesc.js

@@ -1,2 +0,2 @@

/*! http://mths.be/jsesc v0.4.3 by @mathias */
/*! http://mths.be/jsesc v0.5.0 by @mathias */
;(function(root) {

@@ -54,3 +54,3 @@

var isObject = function(value) {
// simple, but good enough for what we need
// This is a very simple check, but it’s good enough for what we need.
return toString.call(value) == '[object Object]';

@@ -62,2 +62,9 @@ };

};
var isFunction = function(value) {
// In a perfect world, the `typeof` check would be sufficient. However,
// in Chrome 1–12, `typeof /x/ == 'object'`, and in IE 6–8
// `typeof alert == 'object'` and similar for other host objects.
return typeof value == 'function' ||
toString.call(value) == '[object Function]';
};

@@ -76,3 +83,3 @@ /*--------------------------------------------------------------------------*/

'\t': '\\t'
// `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'
// `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'.
// '\v': '\\x0B'

@@ -83,3 +90,3 @@ };

var regexDigit = /[0-9]/;
var regexWhitelist = /[\x20\x21\x23-\x26\x28-\x5B\x5D-\x7E]/;
var regexWhitelist = /[ !#-&\(-\[\]-~]/;

@@ -115,2 +122,6 @@ var jsesc = function(argument, options) {

if (json && argument && isFunction(argument.toJSON)) {
argument = argument.toJSON();
}
if (!isString(argument)) {

@@ -235,3 +246,3 @@ if (isArray(argument)) {

jsesc.version = '0.4.3';
jsesc.version = '0.5.0';

@@ -238,0 +249,0 @@ /*--------------------------------------------------------------------------*/

{
"name": "jsesc",
"version": "0.4.3",
"version": "0.5.0",
"description": "A JavaScript library for escaping JavaScript strings while generating the shortest possible valid output.",

@@ -12,2 +12,3 @@ "homepage": "http://mths.be/jsesc",

"escape",
"javascript",
"tool"

@@ -44,13 +45,13 @@ ],

},
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-shell": "~0.5.0",
"grunt-template": "~0.2.1",
"istanbul": "~0.1.44",
"qunit-clib": "~1.3.0",
"coveralls": "^2.10.0",
"grunt": "^0.4.5",
"grunt-shell": "^0.7.0",
"grunt-template": "^0.2.3",
"istanbul": "^0.3.0",
"qunit-extras": "^1.2.0",
"qunitjs": "~1.11.0",
"regenerate": "~0.5.4",
"requirejs": "~2.1.9"
"regenerate": "^0.6.2",
"requirejs": "^2.1.14"
}
}

@@ -1,2 +0,2 @@

# jsesc [![Build status](https://travis-ci.org/mathiasbynens/jsesc.png?branch=master)](https://travis-ci.org/mathiasbynens/jsesc) [![Dependency status](https://gemnasium.com/mathiasbynens/jsesc.png)](https://gemnasium.com/mathiasbynens/jsesc)
# jsesc [![Build status](https://travis-ci.org/mathiasbynens/jsesc.svg?branch=master)](https://travis-ci.org/mathiasbynens/jsesc) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/jsesc/master.svg)](https://coveralls.io/r/mathiasbynens/jsesc) [![Dependency status](https://gemnasium.com/mathiasbynens/jsesc.svg)](https://gemnasium.com/mathiasbynens/jsesc)

@@ -162,3 +162,3 @@ This is a JavaScript library for [escaping JavaScript strings](http://mathiasbynens.be/notes/javascript-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](http://mothereff.in/js-escapes)

The `es6` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, any astral Unicode symbols in the input will be escaped using [ECMAScript 6 Unicode code point escape sequences](http://mathiasbynens.be/notes/javascript-escapes#unicode-code-point) instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 environments is a concern, don’t enable this setting.
The `es6` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, any astral Unicode symbols in the input will be escaped using [ECMAScript 6 Unicode code point escape sequences](http://mathiasbynens.be/notes/javascript-escapes#unicode-code-point) instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 environments is a concern, don’t enable this setting. If the `json` setting is enabled, the value for the `es6` setting is ignored (as if it was `false`).

@@ -261,3 +261,3 @@ ```js

The `json` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output is always valid JSON. [Hexadecimal character escape sequences](http://mathiasbynens.be/notes/javascript-escapes#hexadecimal) and [the `\v` or `\0` escape sequences](http://mathiasbynens.be/notes/javascript-escapes#single) will not be used. Setting `json: true` implies `quotes: 'double', wrap: true`, although these values can still be overridden if needed.
The `json` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output is valid JSON. [Hexadecimal character escape sequences](http://mathiasbynens.be/notes/javascript-escapes#hexadecimal) and [the `\v` or `\0` escape sequences](http://mathiasbynens.be/notes/javascript-escapes#single) will not be used. Setting `json: true` implies `quotes: 'double', wrap: true, es6: false`, although these values can still be overridden if needed — but in such cases, the output won’t be valid JSON anymore.

@@ -367,7 +367,7 @@ ```js

To generate [the code coverage report](http://rawgithub.com/mathiasbynens/jsesc/master/coverage/jsesc/jsesc.js.html), use `grunt cover`.
To generate the code coverage report, use `grunt cover`.
## Author
| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") |
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|

@@ -374,0 +374,0 @@ | [Mathias Bynens](http://mathiasbynens.be/) |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc