//第一个数组减去属性相同第二个数组
this.subtract = function () {
var arg = getArg(arguments);
var o = arg["Array"][0] || [];
var o1 = arg["Array"][1] || [];
var judge = arg["function"][0] || arg["string"][0] || function () { return false; };
var param = arg["Object"][0] || {};
if (o.constructor == Array && o1.constructor == Array) {
judge = judge || {};
if (judge.constructor == String) {
judge = judge.replace(/\*0./g, 'a.');
judge = judge.replace(/\*1./g, 'b.');
judge = judge.replace(/@/g, 'param.');
judge = judge.replace(/param.param./g, '@');
var sTt = [];
for (var i = 0, a, iLen = o.length; a = o[i++];) {
var isHave = false;
for (var j = 0, b, jLen = o1.length; b = o1[j++];) {
if (eval(judge)) {
isHave = true;
break;
}
}
if (!isHave) {
sTt.push(a);
}
}
return sTt;
} else if (judge.constructor == Function) {
var sTt = [];
for (var i = 0, a, iLen = o.length; a = o[i++];) {
var isHave = false;
for (var j = 0, b, jLen = o1.length; b = o1[j++];) {
if (judge(a, b)) {
isHave = true;
break;
}
}
if (!isHave) {
sTt.push(a);
}
}
return sTt;
} else if (judge.constructor == Object) {
var sTt = [];
for (var i = 0, a, iLen = o.length; a = o[i++];) {
var isHave = false;
for (var j = 0, b, jLen = o1.length; b = o1[j++];) {
if (isEqualForSimple(a, b)) {
isHave = true;
break;
}
}
if (!isHave) {
sTt.push(a);
}
}
return sTt;
}
}
}
//获取参数
var getArg = function (arg) {
var ret = {
'number': [],
'string': [],
'boolean': [],
'object': [],
'Object': [],
'Array': [],
'function': [],
'Date': [],
'null': []
}
for (var i = 0, len = arg.length; i < len; i++) {
var ar = arg[i];
if (typeof (ar) == 'number') {
ret['number'].push(ar);
} else if (typeof (ar) == 'string') {
ret['string'].push(ar);
} else if (typeof (ar) == 'boolean') {
ret['boolean'].push(ar);
} else if (typeof (ar) == 'function') {
ret['function'].push(ar);
} else if (typeof (ar) == 'object') {
if (ar) {
if (ar.constructor == Object) {
ret['object'].push(ar);
ret['Object'].push(ar);
} else if (ar.constructor == Array) {
ret['object'].push(ar);
ret['Array'].push(ar);
} else if (ar.constructor == Date) {
ret['Date'].push(ar);
}
} else {
ret['null'].push(ar);
}
}
}
return ret;
}