Moved these here functions to Util.
Immediately after writing them I considered that they didn't really belong in ArrayUtil, since they don't operate on Arrays. Util is better, since it's less specific. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5686 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -45,32 +45,6 @@ public class ArrayUtil
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an array containing the property keys of the specified object, in their
|
|
||||||
* natural iteration order.
|
|
||||||
*/
|
|
||||||
public static function keys (obj :Object) :Array
|
|
||||||
{
|
|
||||||
var arr :Array = [];
|
|
||||||
for (var k :* in obj) { // no "each": iterate over keys
|
|
||||||
arr.push(k);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an array containing the property values of the specified object, in their
|
|
||||||
* natural iteration order.
|
|
||||||
*/
|
|
||||||
public static function values (obj :Object) :Array
|
|
||||||
{
|
|
||||||
var arr :Array = [];
|
|
||||||
for each (var v :* in obj) { // "each" iterates over values
|
|
||||||
arr.push(v);
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shallow copy of the array.
|
* Creates a shallow copy of the array.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -87,6 +87,32 @@ public class Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an array containing the property keys of the specified object, in their
|
||||||
|
* natural iteration order.
|
||||||
|
*/
|
||||||
|
public static function keys (obj :Object) :Array
|
||||||
|
{
|
||||||
|
var arr :Array = [];
|
||||||
|
for (var k :* in obj) { // no "each": iterate over keys
|
||||||
|
arr.push(k);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an array containing the property values of the specified object, in their
|
||||||
|
* natural iteration order.
|
||||||
|
*/
|
||||||
|
public static function values (obj :Object) :Array
|
||||||
|
{
|
||||||
|
var arr :Array = [];
|
||||||
|
for each (var v :* in obj) { // "each" iterates over values
|
||||||
|
arr.push(v);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the 'value' object into XML safely. This is equivalent to <code>new XML(value)</code>
|
* Parse the 'value' object into XML safely. This is equivalent to <code>new XML(value)</code>
|
||||||
* but offers protection from other code that may have changing the default settings
|
* but offers protection from other code that may have changing the default settings
|
||||||
|
|||||||
Reference in New Issue
Block a user