[Pkg-javascript-commits] [json-js] 67/85: ternary
Jonas Smedegaard
dr at jones.dk
Mon Mar 14 10:39:43 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 5b81c7b381c505a5a47166df0e2c41060106c4c7
Author: Douglas Crockford <douglas at crockford.com>
Date: Fri May 1 18:07:21 2015 -0700
ternary
---
json.js | 17 +++++++++--------
json2.js | 17 +++++++++--------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/json.js b/json.js
index 8f5d91e..d188cb2 100644
--- a/json.js
+++ b/json.js
@@ -1,6 +1,6 @@
/*
json.js
- 2014-02-25
+ 2015-05-01
Public Domain
@@ -343,8 +343,8 @@ if (typeof JSON !== 'object') {
v = partial.length === 0
? '[]'
: gap
- ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
- : '[' + partial.join(',') + ']';
+ ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
+ : '[' + partial.join(',') + ']';
gap = mind;
return v;
}
@@ -386,8 +386,8 @@ if (typeof JSON !== 'object') {
v = partial.length === 0
? '{}'
: gap
- ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
- : '{' + partial.join(',') + '}';
+ ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
+ : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
@@ -510,9 +510,10 @@ 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, '')
+ text
+ .replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, '')
)) {
// In the third stage we use the eval function to compile the text into a
diff --git a/json2.js b/json2.js
index d403181..bc48164 100644
--- a/json2.js
+++ b/json2.js
@@ -1,6 +1,6 @@
/*
json2.js
- 2015-02-25
+ 2015-05-01
Public Domain.
@@ -311,8 +311,8 @@ if (typeof JSON !== 'object') {
v = partial.length === 0
? '[]'
: gap
- ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
- : '[' + partial.join(',') + ']';
+ ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
+ : '[' + partial.join(',') + ']';
gap = mind;
return v;
}
@@ -358,8 +358,8 @@ if (typeof JSON !== 'object') {
v = partial.length === 0
? '{}'
: gap
- ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
- : '{' + partial.join(',') + '}';
+ ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
+ : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
@@ -483,9 +483,10 @@ if (typeof JSON !== 'object') {
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, '')
+ text
+ .replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, '')
)
) {
--
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