Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-state

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-state - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

12

HISTORY.md
Express State Change History
============================
1.1.2 (2014-02-21)
------------------
* Fixed issue with line terminator characters (`U+2028` and `U+2029`) being
handled differently in JavaScript vs. JSON by escaping them.
([#21][], [#22][]: @norwood, @mathiasbynens)
[#21]: https://github.com/yahoo/express-state/issues/21
[#22]: https://github.com/yahoo/express-state/issues/22
1.1.1 (2014-01-25)

@@ -5,0 +17,0 @@ ------------------

30

lib/serialize.js

@@ -7,12 +7,14 @@ 'use strict';

var IS_NATIVE_CODE_REGEX = /\{\s*\[native code\]\s*\}/g,
PLACE_HOLDER_REGEX = /"@__(FUNCTION|REGEXP)_(\d+)__@"/g,
UNSAFE_HTML_CHARS_REGEX = /[<>\/]/g;
var IS_NATIVE_CODE_REGEX = /\{\s*\[native code\]\s*\}/g,
PLACE_HOLDER_REGEX = /"@__(FUNCTION|REGEXP)_(\d+)__@"/g,
UNSAFE_CHARS_REGEX = /[<>\/\u2028\u2029]/g;
// Mapping of unsafe HTML chars to their Unicode char counterparts which are
// safe to use in JavaScript strings.
var UNICODE_HTML_CHARS = {
'<': '\\u003C',
'>': '\\u003E',
'/': '\\u002F'
// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their
// Unicode char counterparts which are safe to use in JavaScript strings.
var UNICODE_CHARS = {
'<' : '\\u003C',
'>' : '\\u003E',
'/' : '\\u002F',
'\u2028': '\\u2028',
'\u2029': '\\u2029'
};

@@ -46,7 +48,7 @@

// Replace unsafe HTML chars with their safe Unicode char counterpart. This
// _must_ happen before the regexps and functions are serialized and added
// back to the string.
str = str.replace(UNSAFE_HTML_CHARS_REGEX, function (unsafeChar) {
return UNICODE_HTML_CHARS[unsafeChar];
// Replace unsafe HTML and invalid JavaScript line terminator chars with
// their safe Unicode char counterpart. This _must_ happen before the
// regexps and functions are serialized and added back to the string.
str = str.replace(UNSAFE_CHARS_REGEX, function (unsafeChar) {
return UNICODE_CHARS[unsafeChar];
});

@@ -53,0 +55,0 @@

{
"name": "express-state",
"description": "Share server-side state with the client-side of an Express app via JavaScript.",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/yahoo/express-state",

@@ -6,0 +6,0 @@ "keywords": [

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