meowio/jsnes/src/utils.js
Jeremy Penner 8dc252d70f git subrepo clone https://github.com/bfirsh/jsnes.git
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:   "???"
2024-10-29 20:12:13 -04:00

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;
},
};