ES5 space-in-parens
This commit is contained in:
@ -38,7 +38,6 @@
|
||||
"no-lonely-if": 0,
|
||||
"no-mixed-operators": 0,
|
||||
"eqeqeq": 0,
|
||||
"space-in-parens": 0,
|
||||
"max-len": 0,
|
||||
"no-trailing-spaces": 0,
|
||||
"global-require": 0,
|
||||
|
@ -28,7 +28,7 @@ define(
|
||||
coerce_types = { true: !0, false: !1, null: null };
|
||||
|
||||
// Iterate over all name=value pairs.
|
||||
$.each( this.serializeArray(), function (j, v) {
|
||||
$.each(this.serializeArray(), function (j, v) {
|
||||
var key = v.name,
|
||||
val = v.value,
|
||||
cur = obj,
|
||||
@ -36,18 +36,18 @@ define(
|
||||
|
||||
// If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
|
||||
// into its component parts.
|
||||
keys = key.split( '][' ),
|
||||
keys = key.split(']['),
|
||||
keys_last = keys.length - 1;
|
||||
|
||||
// If the first keys part contains [ and the last ends with ], then []
|
||||
// are correctly balanced.
|
||||
if ( /\[/.test( keys[0] ) && /\]$/.test( keys[ keys_last ] ) ) {
|
||||
if (/\[/.test(keys[0]) && /\]$/.test(keys[ keys_last ])) {
|
||||
// Remove the trailing ] from the last keys part.
|
||||
keys[ keys_last ] = keys[ keys_last ].replace( /\]$/, '' );
|
||||
keys[ keys_last ] = keys[ keys_last ].replace(/\]$/, '');
|
||||
|
||||
// Split first keys part into two parts on the [ and add them back onto
|
||||
// the beginning of the keys array.
|
||||
keys = keys.shift().split('[').concat( keys );
|
||||
keys = keys.shift().split('[').concat(keys);
|
||||
|
||||
keys_last = keys.length - 1;
|
||||
} else {
|
||||
@ -56,14 +56,14 @@ define(
|
||||
}
|
||||
|
||||
// Coerce values.
|
||||
if ( coerce ) {
|
||||
if (coerce) {
|
||||
val = val && !isNaN(val) ? +val // number
|
||||
: val === 'undefined' ? undefined // undefined
|
||||
: coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
|
||||
: val; // string
|
||||
}
|
||||
|
||||
if ( keys_last ) {
|
||||
if (keys_last) {
|
||||
// Complex key, build deep object structure based on a few rules:
|
||||
// * The 'cur' pointer starts at the object top-level.
|
||||
// * [] = array push (n is set to array length), [n] = array if n is
|
||||
@ -73,10 +73,10 @@ define(
|
||||
// object or array based on the type of the next keys part.
|
||||
// * Move the 'cur' pointer to the next level.
|
||||
// * Rinse & repeat.
|
||||
for ( ; i <= keys_last; i++ ) {
|
||||
for (; i <= keys_last; i++) {
|
||||
key = keys[i] === '' ? cur.length : keys[i];
|
||||
cur[key] = i < keys_last
|
||||
? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] )
|
||||
? cur[key] || (keys[i+1] && isNaN(keys[i+1]) ? {} : [])
|
||||
: val;
|
||||
cur = cur[key];
|
||||
}
|
||||
@ -85,11 +85,11 @@ define(
|
||||
// Simple key, even simpler rules, since only scalars and shallow
|
||||
// arrays are allowed.
|
||||
|
||||
if ( $.isArray( obj[key] ) ) {
|
||||
if ($.isArray(obj[key])) {
|
||||
// val is already an array, so push on the next value.
|
||||
obj[key].push( val );
|
||||
obj[key].push(val);
|
||||
|
||||
} else if ( obj[key] !== undefined ) {
|
||||
} else if (obj[key] !== undefined) {
|
||||
// val isn't an array, but since a second value has been specified,
|
||||
// convert val into an array.
|
||||
obj[key] = [ obj[key], val ];
|
||||
|
@ -262,7 +262,7 @@ define([
|
||||
// Reset whole model in order for change events to propagate properly
|
||||
that.model.set('terms', terms.toJSON());
|
||||
}
|
||||
}).trigger( 'change' );
|
||||
}).trigger('change');
|
||||
},
|
||||
toggleDisplayOptions: function (event) {
|
||||
var el = this.$('.mailpoet_automated_latest_content_display_options'),
|
||||
|
@ -253,7 +253,7 @@ define([
|
||||
editable: editable && function () {
|
||||
this.controller.content.mode('edit-selection');
|
||||
}
|
||||
}).render() );
|
||||
}).render());
|
||||
},
|
||||
|
||||
mainInsertToolbar: function (view) {
|
||||
|
@ -407,7 +407,7 @@ define([
|
||||
// Reset whole model in order for change events to propagate properly
|
||||
that.model.set('terms', terms.toJSON());
|
||||
}
|
||||
}).trigger( 'change' );
|
||||
}).trigger('change');
|
||||
},
|
||||
changeField: function (field, event) {
|
||||
this.model.set(field, jQuery(event.target).val());
|
||||
|
@ -331,7 +331,7 @@ define(
|
||||
email = test[1].trim();
|
||||
}
|
||||
// test for valid characters using WP's rule (https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/formatting.php#L2902)
|
||||
if (!/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\-@]+$/.test(email) ) {
|
||||
if (!/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\-@]+$/.test(email)) {
|
||||
return false;
|
||||
}
|
||||
return email;
|
||||
|
Reference in New Issue
Block a user