Skip to content

Commit

Permalink
Version 1.5.3:
Browse files Browse the repository at this point in the history
JSON2 library was updated to version of May 3, 2015.
  • Loading branch information
Taritsyn committed May 5, 2015
1 parent 60d99cc commit 8c68e58
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 59 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Change log
==========

## May 5, 2015 - v1.5.3
* JSON2 library was updated to version of May 3, 2015

## April 5, 2015 - v1.5.2
* JSON2 library was updated to version of February 25, 2015

Expand Down
4 changes: 2 additions & 2 deletions MsieJavaScriptEngine/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: ComVisible(false)]
[assembly: Guid("ae6911c9-e2a9-4386-ab90-3722a9166564")]

[assembly: AssemblyVersion("1.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.0")]

[module: DefaultCharSet(CharSet.Unicode)]
111 changes: 59 additions & 52 deletions MsieJavaScriptEngine/Resources/json2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
json2.js
2015-02-25
2015-05-03
Public Domain.
Expand All @@ -17,7 +17,9 @@
This file creates a global JSON object containing two methods: stringify
and parse.
and parse. This file is provides the ES5 JSON capability to ES3 systems.
If a project might run on IE8 or earlier, then this file should be included.
This file does nothing on ES5 systems.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
Expand Down Expand Up @@ -49,8 +51,8 @@
function f(n) {
// Format integers to have at least two digits.
return n < 10
? '0' + n
: n;
? '0' + n
: n;
}
return this.getUTCFullYear() + '-' +
Expand Down Expand Up @@ -96,8 +98,9 @@
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
return this[key] instanceof Date
? 'Date(' + this[key] + ')'
: value;
});
// text is '["Date(---current time---)"]'
Expand Down Expand Up @@ -169,12 +172,19 @@ if (typeof JSON !== 'object') {

(function () {
'use strict';

var rx_one = /^[\],:{}\s]*$/,
rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rx_four = /(?:^|:|,)(?:\s*\[)+/g,
rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;

function f(n) {
// Format integers to have at least two digits.
return n < 10
? '0' + n
: n;
? '0' + n
: n;
}

function this_value() {
Expand All @@ -186,23 +196,21 @@ if (typeof JSON !== 'object') {
Date.prototype.toJSON = function () {

return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};

Boolean.prototype.toJSON = this_value;
Number.prototype.toJSON = this_value;
String.prototype.toJSON = this_value;
}

var cx,
escapable,
gap,
var gap,
indent,
meta,
rep;
Expand All @@ -215,15 +223,15 @@ if (typeof JSON !== 'object') {
// Otherwise we must also replace the offending characters with safe escape
// sequences.

escapable.lastIndex = 0;
return escapable.test(string)
? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"'
: '"' + string + '"';
rx_escapable.lastIndex = 0;
return rx_escapable.test(string)
? '"' + string.replace(rx_escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"'
: '"' + string + '"';
}


Expand Down Expand Up @@ -264,8 +272,8 @@ if (typeof JSON !== 'object') {
// JSON numbers must be finite. Encode non-finite numbers as null.

return isFinite(value)
? String(value)
: 'null';
? String(value)
: 'null';

case 'boolean':
case 'null':
Expand Down Expand Up @@ -309,10 +317,10 @@ if (typeof JSON !== 'object') {
// brackets.

v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
Expand All @@ -328,8 +336,8 @@ if (typeof JSON !== 'object') {
if (v) {
partial.push(quote(k) + (
gap
? ': '
: ':'
? ': '
: ':'
) + v);
}
}
Expand All @@ -344,8 +352,8 @@ if (typeof JSON !== 'object') {
if (v) {
partial.push(quote(k) + (
gap
? ': '
: ':'
? ': '
: ':'
) + v);
}
}
Expand All @@ -356,10 +364,10 @@ if (typeof JSON !== 'object') {
// and wrap them in braces.

v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
Expand All @@ -368,7 +376,6 @@ if (typeof JSON !== 'object') {
// If the JSON object does not yet have a stringify method, give it one.

if (typeof JSON.stringify !== 'function') {
escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
Expand Down Expand Up @@ -425,7 +432,6 @@ if (typeof JSON !== 'object') {
// If the JSON object does not yet have a parse method, give it one.

if (typeof JSON.parse !== 'function') {
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
Expand Down Expand Up @@ -460,9 +466,9 @@ if (typeof JSON !== 'object') {
// incorrectly, either silently deleting them, or treating them as line endings.

text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
rx_dangerous.lastIndex = 0;
if (rx_dangerous.test(text)) {
text = text.replace(rx_dangerous, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
Expand All @@ -482,10 +488,11 @@ if (typeof JSON !== 'object') {
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

if (
/^[\],:{}\s]*$/.test(
text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, '')
rx_one.test(
text
.replace(rx_two, '@')
.replace(rx_three, ']')
.replace(rx_four, '')
)
) {

Expand All @@ -500,8 +507,8 @@ if (typeof JSON !== 'object') {
// each name/value pair to a reviver function for possible transformation.

return typeof reviver === 'function'
? walk({'': j}, '')
: j;
? walk({'': j}, '')
: j;
}

// If the text is not JSON parseable, then a SyntaxError is thrown.
Expand Down
2 changes: 1 addition & 1 deletion MsieJavaScriptEngine/Resources/json2.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions NuGet/MsieJavaScriptEngine.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MsieJavaScriptEngine</id>
<version>1.5.2</version>
<version>1.5.3</version>
<title>MSIE JavaScript Engine for .NET</title>
<authors>Andrey Taritsyn</authors>
<owners>Andrey Taritsyn</owners>
Expand All @@ -12,7 +12,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This project is a .NET wrapper for working with the Internet Explorer's JavaScript engines (JsRT version of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine). Project was based on the code of SassAndCoffee.JavaScript (http://github.com/paulcbetts/SassAndCoffee) and Chakra Sample Hosts (http://github.com/panopticoncentral/chakra-host).</description>
<summary>This project is a .NET wrapper for working with the Internet Explorer's JavaScript engines (JsRT version of Chakra, ActiveScript version of Chakra and Classic JavaScript Engine).</summary>
<releaseNotes>JSON2 library was updated to version of February 25, 2015.</releaseNotes>
<releaseNotes>JSON2 library was updated to version of May 3, 2015.</releaseNotes>
<copyright>Copyright (c) 2012-2015 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
<language>en-US</language>
<tags>JavaScript ECMAScript MSIE IE Chakra</tags>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


----------------------------------------------------------------------
README file for MSIE JavaScript Engine for .NET 1.5.2
README file for MSIE JavaScript Engine for .NET 1.5.3

----------------------------------------------------------------------

Expand All @@ -21,7 +21,7 @@
=============
RELEASE NOTES
=============
JSON2 library was updated to version of February 25, 2015.
JSON2 library was updated to version of May 3, 2015.

============
PROJECT SITE
Expand Down

0 comments on commit 8c68e58

Please sign in to comment.