forked from 0x2620/oxjs
- remove editItem from Ox.List
- use ArrayEditable for text too
This commit is contained in:
parent
66934d22a9
commit
093edd57d0
12 changed files with 180 additions and 403 deletions
|
|
@ -104,8 +104,8 @@ Ox.filter <f> Filters a collection by a given condition
|
|||
objects and strings.
|
||||
> Ox.filter([2, 1, 0], function(v, i) { return v == i; })
|
||||
[1]
|
||||
> Ox.keys(Ox.filter({a: 'c', b: 'b', c: 'a'}, function(v, k) { return v == k; }))
|
||||
['b']
|
||||
> Ox.filter({a: 'c', b: 'b', c: 'a'}, function(v, k) { return v == k; })
|
||||
{b: 'b'}
|
||||
> Ox.filter(' foo bar ', function(v) { return v != ' '; })
|
||||
'foobar'
|
||||
@*/
|
||||
|
|
@ -113,14 +113,14 @@ Ox.filter <f> Filters a collection by a given condition
|
|||
Ox.filter = function(col, fn) {
|
||||
var type = Ox.typeOf(col),
|
||||
ret = type == 'array' ? [] : type == 'object' ? {} : '';
|
||||
Ox.forEach(col, function(v, k) {
|
||||
if (fn(v, k)) {
|
||||
Ox.forEach(col, function(val, key) {
|
||||
if (fn(val, key)) {
|
||||
if (type == 'array') {
|
||||
ret.push(v);
|
||||
ret.push(val);
|
||||
} else if (type == 'object') {
|
||||
ret[k] = v;
|
||||
ret[key] = val;
|
||||
} else {
|
||||
ret += v;
|
||||
ret += val;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -384,7 +384,7 @@ Ox.last = function(arr, val) {
|
|||
Ox.len <f> Returns the length of an array, function, object or string
|
||||
Not to be confused with <code>Ox.length</code>, which is the
|
||||
<code>length</code> property of the <code>Ox</code> function
|
||||
(<code>1</code>).
|
||||
(<code>1</code>). // FIXME: 1 becomes 67 in DocPanel
|
||||
> Ox.len([1, 2, 3])
|
||||
3
|
||||
> Ox.len([,])
|
||||
|
|
@ -455,7 +455,6 @@ Ox.makeArray <f> Takes an array-like object and returns a true array
|
|||
> Ox.makeArray({0: "f", 1: "o", 2: "o", length: 3})
|
||||
["f", "o", "o"]
|
||||
@*/
|
||||
|
||||
Ox.makeArray = /MSIE/.test(navigator.userAgent)
|
||||
? function(col) {
|
||||
var i, len, ret = [];
|
||||
|
|
@ -632,7 +631,6 @@ Ox.shuffle <f> Randomizes the order of values within a collection
|
|||
> Ox.shuffle('123').length
|
||||
3
|
||||
@*/
|
||||
|
||||
Ox.shuffle = function(col) {
|
||||
var keys, ret, type = Ox.typeOf(col), values;
|
||||
function sort() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue