Jeremy Penner
8dc252d70f
subrepo: subdir: "jsnes" merged: "d8021d0" upstream: origin: "https://github.com/bfirsh/jsnes.git" branch: "master" commit: "d8021d0" git-subrepo: version: "0.4.9" origin: "???" commit: "???"
26 lines
622 B
JavaScript
26 lines
622 B
JavaScript
module.exports = {
|
|
copyArrayElements: function (src, srcPos, dest, destPos, length) {
|
|
for (var i = 0; i < length; ++i) {
|
|
dest[destPos + i] = src[srcPos + i];
|
|
}
|
|
},
|
|
|
|
copyArray: function (src) {
|
|
return src.slice(0);
|
|
},
|
|
|
|
fromJSON: function (obj, state) {
|
|
for (var i = 0; i < obj.JSON_PROPERTIES.length; i++) {
|
|
obj[obj.JSON_PROPERTIES[i]] = state[obj.JSON_PROPERTIES[i]];
|
|
}
|
|
},
|
|
|
|
toJSON: function (obj) {
|
|
var state = {};
|
|
for (var i = 0; i < obj.JSON_PROPERTIES.length; i++) {
|
|
state[obj.JSON_PROPERTIES[i]] = obj[obj.JSON_PROPERTIES[i]];
|
|
}
|
|
return state;
|
|
},
|
|
};
|