[Pkg-javascript-commits] [json-js] 19/85: Imported Upstream version 0~20111020
Jonas Smedegaard
dr at jones.dk
Mon Mar 14 10:39:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository json-js.
commit 9170409291c05f8880fa3d8c9d91dd76945ff959
Author: Jonas Smedegaard <dr at jones.dk>
Date: Fri Dec 23 13:25:33 2011 +0700
Imported Upstream version 0~20111020
---
cycle.js | 10 +++++-----
json.js | 6 +++---
json2.js | 47 +++++++++++++++++++++++++++--------------------
3 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/cycle.js b/cycle.js
index b6fa7dd..1ced7da 100755
--- a/cycle.js
+++ b/cycle.js
@@ -1,7 +1,7 @@
// cycle.js
-// 2011-02-23
+// 2011-08-24
-/*jslint evil: true, regexp: false */
+/*jslint evil: true, regexp: true */
/*members $ref, apply, call, decycle, hasOwnProperty, length, prototype, push,
retrocycle, stringify, test, toString
@@ -9,7 +9,7 @@
if (typeof JSON.decycle !== 'function') {
JSON.decycle = function decycle(object) {
- "use strict";
+ 'use strict';
// Make a deep copy of an object or array, assuring that there is at most
// one instance of each object or array in the resulting structure. The
@@ -94,7 +94,7 @@ if (typeof JSON.decycle !== 'function') {
if (typeof JSON.retrocycle !== 'function') {
JSON.retrocycle = function retrocycle($) {
- "use strict";
+ 'use strict';
// Restore an object that was reduced by decycle. Members whose values are
// objects of the form
@@ -116,7 +116,7 @@ if (typeof JSON.retrocycle !== 'function') {
// produces an array containing a single element which is the array itself.
var px =
- /^\$(?:\[(?:\d?|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/;
+ /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/;
(function rez(value) {
diff --git a/json.js b/json.js
index ef5f30e..1c2b253 100755
--- a/json.js
+++ b/json.js
@@ -1,6 +1,6 @@
/*
json.js
- 2011-02-23
+ 2011-08-30
Public Domain
@@ -183,7 +183,7 @@
redistribute.
*/
-/*jslint evil: true, regexp: false */
+/*jslint evil: true, regexp: true, unparam: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
@@ -202,7 +202,7 @@ if (!JSON) {
}
(function () {
- "use strict";
+ 'use strict';
function f(n) {
// Format integers to have at least two digits.
diff --git a/json2.js b/json2.js
index b4c02d3..2dbf60d 100755
--- a/json2.js
+++ b/json2.js
@@ -1,6 +1,6 @@
/*
http://www.JSON.org/json2.js
- 2011-02-23
+ 2011-10-19
Public Domain.
@@ -146,7 +146,7 @@
redistribute.
*/
-/*jslint evil: true, strict: false, regexp: false */
+/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
@@ -165,7 +165,7 @@ if (!JSON) {
}
(function () {
- "use strict";
+ 'use strict';
function f(n) {
// Format integers to have at least two digits.
@@ -176,13 +176,14 @@ if (!JSON) {
Date.prototype.toJSON = function (key) {
- 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;
+ 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;
};
String.prototype.toJSON =
@@ -218,8 +219,9 @@ if (!JSON) {
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);
+ return typeof c === 'string'
+ ? c
+ : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
@@ -303,9 +305,11 @@ if (!JSON) {
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
- v = partial.length === 0 ? '[]' : gap ?
- '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
- '[' + partial.join(',') + ']';
+ v = partial.length === 0
+ ? '[]'
+ : gap
+ ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
+ : '[' + partial.join(',') + ']';
gap = mind;
return v;
}
@@ -340,9 +344,11 @@ if (!JSON) {
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
- v = partial.length === 0 ? '{}' : gap ?
- '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
- '{' + partial.join(',') + '}';
+ v = partial.length === 0
+ ? '{}'
+ : gap
+ ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
+ : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
@@ -468,8 +474,9 @@ if (!JSON) {
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
+ return typeof reviver === 'function'
+ ? walk({'': j}, '')
+ : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/json-js.git
More information about the Pkg-javascript-commits
mailing list