Skip to content

Commit

Permalink
Version 1.5.2:
Browse files Browse the repository at this point in the history
JSON2 library was updated to version of February 25, 2015.
  • Loading branch information
Taritsyn committed Apr 5, 2015
1 parent de376fb commit 60d99cc
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 48 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
==========

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

## January 13, 2015 - v1.5.1
* In ECMAScript 5 Polyfill added polyfill for the `String.prototype.split` method

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.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyVersion("1.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]

[module: DefaultCharSet(CharSet.Unicode)]
103 changes: 63 additions & 40 deletions MsieJavaScriptEngine/Resources/json2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
json2.js
2014-02-04
2015-02-25
Public Domain.
Expand Down Expand Up @@ -48,7 +48,9 @@
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
return n < 10
? '0' + n
: n;
}
return this.getUTCFullYear() + '-' +
Expand Down Expand Up @@ -146,10 +148,12 @@
redistribute.
*/

/*jslint evil: true, regexp: true */
/*jslint
eval, for, this
*/

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
/*property
JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
Expand All @@ -168,28 +172,32 @@ if (typeof JSON !== 'object') {

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

function this_value() {
return this.valueOf();
}

if (typeof Date.prototype.toJSON !== 'function') {

Date.prototype.toJSON = function () {

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

String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function () {
return this.valueOf();
};
Boolean.prototype.toJSON = this_value;
Number.prototype.toJSON = this_value;
String.prototype.toJSON = this_value;
}

var cx,
Expand All @@ -208,12 +216,14 @@ if (typeof JSON !== 'object') {
// sequences.

escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
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 + '"';
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"'
: '"' + string + '"';
}


Expand Down Expand Up @@ -253,7 +263,9 @@ if (typeof JSON !== 'object') {

// JSON numbers must be finite. Encode non-finite numbers as null.

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

case 'boolean':
case 'null':
Expand Down Expand Up @@ -297,10 +309,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 @@ -314,7 +326,11 @@ if (typeof JSON !== 'object') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
partial.push(quote(k) + (
gap
? ': '
: ':'
) + v);
}
}
}
Expand All @@ -326,7 +342,11 @@ if (typeof JSON !== 'object') {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
partial.push(quote(k) + (
gap
? ': '
: ':'
) + v);
}
}
}
Expand All @@ -336,10 +356,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 @@ -348,14 +368,14 @@ if (typeof JSON !== 'object') {
// If the JSON object does not yet have a stringify method, give it one.

if (typeof JSON.stringify !== 'function') {
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
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',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'"': '\\"',
'\\': '\\\\'
};
JSON.stringify = function (value, replacer, space) {
Expand Down Expand Up @@ -444,7 +464,7 @@ if (typeof JSON !== 'object') {
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}

Expand All @@ -461,10 +481,13 @@ if (typeof JSON !== 'object') {
// we look to see that the remaining characters are only whitespace or ']' or
// ',' 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, '@')
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, ''))) {
.replace(/(?:^|:|,)(?:\s*\[)+/g, '')
)
) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
Expand All @@ -477,8 +500,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.1</version>
<version>1.5.2</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>In ECMAScript 5 Polyfill added polyfill for the `String.prototype.split` method.</releaseNotes>
<releaseNotes>JSON2 library was updated to version of February 25, 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
5 changes: 2 additions & 3 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.1
README file for MSIE JavaScript Engine for .NET 1.5.2

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

Expand All @@ -21,8 +21,7 @@
=============
RELEASE NOTES
=============
In ECMAScript 5 Polyfill added polyfill for
the `String.prototype.split` method.
JSON2 library was updated to version of February 25, 2015.

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

0 comments on commit 60d99cc

Please sign in to comment.