Skip to content
Browse files

reorder core functions

  • Loading branch information...
1 parent 045420a commit 2a296be7942ba543a52d467db1f4278980fd90a9 @jpmckinney jpmckinney committed Apr 13, 2013
Showing with 55 additions and 55 deletions.
  1. +55 −55 core/Core.js
View
110 core/Core.js
@@ -32,6 +32,61 @@ AjaxSolr.Class.extend = function (properties) {
};
/**
+ * A simplified version of jQuery's extend function.
+ *
+ * @static
+ * @see http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
+ */
+AjaxSolr.extend = function () {
+ var target = arguments[0] || {}, i = 1, length = arguments.length, options;
+ for (; i < length; i++) {
+ if ((options = arguments[i]) != null) {
+ for (var name in options) {
+ var src = target[name], copy = options[name];
+ if (target === copy) {
+ continue;
+ }
+ if (copy && typeof copy == 'object' && !copy.nodeType) {
+ target[name] = AjaxSolr.extend(src || (copy.length != null ? [] : {}), copy);
+ }
+ else if (copy && src && typeof copy == 'function' && typeof src == 'function') {
+ target[name] = (function(superfn, fn) {
+ return function () {
+ var tmp = this._super, ret;
+ this._super = superfn;
+ ret = fn.apply(this, arguments);
+ this._super = tmp;
+ return ret;
+ };
+ })(src, copy);
+ }
+ else if (copy !== undefined) {
+ target[name] = copy;
+ }
+ }
+ }
+ }
+ return target;
+};
+
+/**
+ * @static
+ * @param value A value.
+ * @param array An array.
+ * @returns {Boolean} Whether value exists in the array.
+ */
+AjaxSolr.inArray = function (value, array) {
+ if (array) {
+ for (var i = 0, l = array.length; i < l; i++) {
+ if (AjaxSolr.equals(array[i], value)) {
+ return i;
+ }
+ }
+ }
+ return -1;
+};
+
+/**
* @static
* @param foo A value.
* @param bar A value.
@@ -61,23 +116,6 @@ AjaxSolr.equals = function (foo, bar) {
};
/**
- * @static
- * @param value A value.
- * @param array An array.
- * @returns {Boolean} Whether value exists in the array.
- */
-AjaxSolr.inArray = function (value, array) {
- if (array) {
- for (var i = 0, l = array.length; i < l; i++) {
- if (AjaxSolr.equals(array[i], value)) {
- return i;
- }
- }
- }
- return -1;
-};
-
-/**
* Can't use toString.call(obj) === "[object Array]", as it may return
* "[xpconnect wrapped native prototype]", which is undesirable.
*
@@ -104,41 +142,3 @@ AjaxSolr.isRegExp = function (obj) {
AjaxSolr.isString = function (obj) {
return obj != null && typeof obj == 'string';
};
-
-/**
- * A simplified version of jQuery's extend function.
- *
- * @static
- * @see http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
- */
-AjaxSolr.extend = function () {
- var target = arguments[0] || {}, i = 1, length = arguments.length, options;
- for (; i < length; i++) {
- if ((options = arguments[i]) != null) {
- for (var name in options) {
- var src = target[name], copy = options[name];
- if (target === copy) {
- continue;
- }
- if (copy && typeof copy == 'object' && !copy.nodeType) {
- target[name] = AjaxSolr.extend(src || (copy.length != null ? [] : {}), copy);
- }
- else if (copy && src && typeof copy == 'function' && typeof src == 'function') {
- target[name] = (function(superfn, fn) {
- return function () {
- var tmp = this._super, ret;
- this._super = superfn;
- ret = fn.apply(this, arguments);
- this._super = tmp;
- return ret;
- };
- })(src, copy);
- }
- else if (copy !== undefined) {
- target[name] = copy;
- }
- }
- }
- }
- return target;
-};

0 comments on commit 2a296be

Please sign in to comment.
Something went wrong with that request. Please try again.