do not alias Ox.contains as Ox.in
This commit is contained in:
parent
d4bcc66fe8
commit
bdb399614f
1 changed files with 3 additions and 11 deletions
|
@ -15,15 +15,6 @@ Ox.avg = function(obj) {
|
|||
return Ox.sum(obj) / Ox.len(obj);
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.break <f> end loops by calling Ox.break()
|
||||
@*/
|
||||
Ox.break = function() {
|
||||
throw Ox.BreakError;
|
||||
};
|
||||
|
||||
Ox.BreakError = new SyntaxError('Illegal Ox.break() statement');
|
||||
|
||||
/*@
|
||||
Ox.clone <f> Returns a (shallow or deep) copy of an object or array
|
||||
> (function() { var a = ['v'], b = Ox.clone(a); a[0] = null; return b[0]; }())
|
||||
|
@ -60,7 +51,8 @@ Ox.contains <f> Tests if a collection contains a value
|
|||
> Ox.contains("foobar", "bar")
|
||||
true
|
||||
@*/
|
||||
Ox.contains = Ox.in = function(col, val) {
|
||||
// FIXME: a shorter name would be nice (but IE8 doesn't like 'in')
|
||||
Ox.contains = function(col, val) {
|
||||
return (Ox.isObject(col) ? Ox.values(col) : col).indexOf(val) > -1;
|
||||
};
|
||||
|
||||
|
@ -298,7 +290,7 @@ Ox.indexOf <f> <code>indexOf</code> with a test function
|
|||
@*/
|
||||
Ox.indexOf = function(col, fn) {
|
||||
var index = Ox.forEach(col, function(val) {
|
||||
fn(val) && Ox.break();
|
||||
fn(val) && Ox.Break();
|
||||
});
|
||||
return index == col.length ? -1 : index;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue