Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

JSlint enabled in ready's config

  • Loading branch information...
commit 033fbcfb75c12f979744e885ea762289350fb195 1 parent 4dd1c86
@cmilfont cmilfont authored
View
9 docs/index.html
@@ -295,17 +295,18 @@
<span class="keyword">var</span> <span class="variable">verifyArray</span> = <span class="keyword">function</span>(<span class="variable">name</span>, <span class="variable">value</span>) {
<span class="keyword">var</span> <span class="variable">position</span>;
- <span class="keyword">if</span>( <span class="variable">position</span> = <span class="variable">name</span>.<span class="variable">match</span>(<span class="regexp">/\[(\d+)\]/</span>)) {
+ <span class="keyword">if</span>( <span class="variable">name</span>.<span class="variable">match</span>(<span class="regexp">/\[(\d+)\]/</span>) ) {
+ <span class="variable">position</span> = <span class="variable">name</span>.<span class="variable">match</span>(<span class="regexp">/\[(\d+)\]/</span>);
<span class="keyword">var</span> <span class="variable">arr</span> = [];
<span class="variable">arr</span>[ <span class="variable">position</span>[<span class="number integer">1</span>] ] = <span class="variable">value</span>;
<span class="keyword">return</span> <span class="variable">arr</span>;
} <span class="keyword">else</span> {
<span class="keyword">return</span> <span class="variable">value</span>;
}
- }
+ };
- <span class="keyword">return</span> (<span class="keyword">function</span> <span class="variable">generateJSON</span>(<span class="variable">json</span>, <span class="variable">hierarchy</span>, <span class="variable">value</span>) {
- <span class="keyword">var</span> <span class="variable">hierarchy</span> = <span class="variable">hierarchy</span>.<span class="variable">split</span>(&<span class="variable">quot</span>;.&<span class="variable">quot</span>;);
+ <span class="keyword">return</span> (<span class="keyword">function</span> <span class="variable">generateJSON</span>(<span class="variable">json</span>, <span class="variable">hierarchyIn</span>, <span class="variable">value</span>) {
+ <span class="keyword">var</span> <span class="variable">hierarchy</span> = <span class="variable">hierarchyIn</span>.<span class="variable">split</span>(&<span class="variable">quot</span>;.&<span class="variable">quot</span>;);
<span class="keyword">var</span> <span class="variable">first</span> = <span class="variable">hierarchy</span>.<span class="variable">shift</span>();
<span class="keyword">return</span> <span class="keyword">function</span>(<span class="variable">json</span>, <span class="variable">name</span>){
<span class="variable">json</span>[ <span class="variable">prefix</span> + <span class="variable">name</span>.<span class="variable">replace</span>(<span class="regexp">/\[(\d+)\]/</span>, &<span class="variable">quot</span>;&<span class="variable">quot</span>;) + <span class="variable">suffix</span> ] = (<span class="variable">hierarchy</span>.<span class="variable">length</span> &<span class="variable">gt</span>; <span class="number integer">0</span> ) ?
View
11 lib/jsonform.js
@@ -15,7 +15,7 @@
/**
* @version stable
*/
- version: '1.2.0',
+ version: '1.2.1',
/**
* Example:
@@ -141,17 +141,18 @@
var verifyArray = function(name, value) {
var position;
- if( position = name.match(/\[(\d+)\]/)) {
+ if( name.match(/\[(\d+)\]/) ) {
+ position = name.match(/\[(\d+)\]/);
var arr = [];
arr[ position[1] ] = value;
return arr;
} else {
return value;
}
- }
+ };
- return (function generateJSON(json, hierarchy, value) {
- var hierarchy = hierarchy.split(".");
+ return (function generateJSON(json, hierarchyIn, value) {
+ var hierarchy = hierarchyIn.split(".");
var first = hierarchy.shift();
return function(json, name){
json[ prefix + name.replace(/\[(\d+)\]/, "") + suffix ] = (hierarchy.length > 0 ) ?
View
4 minified/jsonform.min.js
@@ -5,5 +5,5 @@
http://jquery.org/license
*/
(function(l){l.fn.extend({version:"1.2.0",getJSON:function(b){var d={},a=this,e;typeof b==="object"&&(e=b,b=e.byId?e.byId:false);a.find("input,textarea,select").each(function(c,f){var j=b?l.trim(f.id):l.trim(f.name);j!==""&&a.merge(d,a.buildJson(j,f.value,e))});return d},populate:function(b,d){var a=this;(function c(f,j){for(var h in f)if(f[h]||f[h]===0){var g=f[h];if(typeof g=="object"){var i=!j?h:j+"\\."+h;if(l.isArray(g))for(var b in g)g[b]&&(parent_arr=i+"\\["+b+"\\]",c(g[b],parent_arr));else c(g,
-i)}else{var i=j?j+"\\."+h:h,k="[name='"+i+"']";d&&(k="#"+i);a.find(k).val(g)}}})(b);return this},buildJson:function(b,d,a){var e=a&&a.prefix?a.prefix:"",c=a&&a.suffix?a.suffix:"",f=function(a,b){var g;if(g=a.match(/\[(\d+)\]/)){var i=[];i[g[1]]=b;return i}else return b};return function h(a,b,d){var b=b.split("."),k=b.shift();a[e+k.replace(/\[(\d+)\]/,"")+c]=b.length>0?f(k,h({},b.join("."),d)):f(k,d);return a}({},b,d)},merge:function d(a,e){for(var c in e)typeof e[c]==="object"&&typeof a[c]!=="undefined"?
-d(a[c],e[c]):a[c]=e[c];return a}})})(jQuery);
+i)}else{var i=j?j+"\\."+h:h,k="[name='"+i+"']";d&&(k="#"+i);a.find(k).val(g)}}})(b);return this},buildJson:function(b,d,a){var e=a&&a.prefix?a.prefix:"",c=a&&a.suffix?a.suffix:"",f=function(a,b){var g;if(a.match(/\[(\d+)\]/)){g=a.match(/\[(\d+)\]/);var i=[];i[g[1]]=b;return i}else return b};return function h(a,b,d){var b=b.split("."),k=b.shift();a[e+k.replace(/\[(\d+)\]/,"")+c]=b.length>0?f(k,h({},b.join("."),d)):f(k,d);return a}({},b,d)},merge:function d(a,e){for(var c in e)typeof e[c]==="object"&&
+typeof a[c]!=="undefined"?d(a[c],e[c]):a[c]=e[c];return a}})})(jQuery);
View
2  ready.conf.js
@@ -2,6 +2,6 @@
"src" : "./lib"
, "dest" : "./minified"
, "runGCompiler" : true
- , runJslint : false
+ , runJslint : true
, aggregateTo : "jsonform.min.js"
}
Please sign in to comment.
Something went wrong with that request. Please try again.