mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-23 14:13:47 +01:00
25 lines
572 B
JavaScript
25 lines
572 B
JavaScript
/* */
|
|
var $ = require("./$"),
|
|
$def = require("./$.def");
|
|
function createObjectToArray(isEntries) {
|
|
return function(object) {
|
|
var O = $.toObject(object),
|
|
keys = $.getKeys(O),
|
|
length = keys.length,
|
|
i = 0,
|
|
result = Array(length),
|
|
key;
|
|
if (isEntries)
|
|
while (length > i)
|
|
result[i] = [key = keys[i++], O[key]];
|
|
else
|
|
while (length > i)
|
|
result[i] = O[keys[i++]];
|
|
return result;
|
|
};
|
|
}
|
|
$def($def.S, 'Object', {
|
|
values: createObjectToArray(false),
|
|
entries: createObjectToArray(true)
|
|
});
|