Browse Source

Pull request #2652: 无JIRA BI.remove 方法同时支持函数形式的predicate和value

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '9c68a77abfa351a06fb7add82ffe92c7861cd53f':
  无JIRA BI.remove 方法同时支持函数形式的predicate和value
es6
Dailer 3 years ago
parent
commit
04e3c4e3f0
  1. 4
      src/core/2.base.js

4
src/core/2.base.js

@ -281,13 +281,13 @@
var i;
if (BI.isArray(obj)) {
for (i = 0; i < obj.length; i++) {
if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && BI.contains(target, obj[i]))) {
if ((isFunction && (target === obj[i] || target.apply(context, [i, obj[i]]) === true)) || (!isFunction && BI.contains(target, obj[i]))) {
obj.splice(i--, 1);
}
}
} else {
BI.each(obj, function (i, v) {
if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && BI.contains(target, obj[i]))) {
if ((isFunction && (target === obj[i] || target.apply(context, [i, obj[i]]) === true)) || (!isFunction && BI.contains(target, obj[i]))) {
delete obj[i];
}
});

Loading…
Cancel
Save