Skip to content

Instantly share code, notes, and snippets.

@miguelludert
Last active August 29, 2015 14:17
Show Gist options
  • Save miguelludert/e1c7b232fb926ba93625 to your computer and use it in GitHub Desktop.
Save miguelludert/e1c7b232fb926ba93625 to your computer and use it in GitHub Desktop.
rockout fromJS
ko.rockout.fromJS = function fromJS(target) {
target = ko.toJS(target);
if (_.isPlainObject(target)) {
var result = {};
_.each(target, function (item, key) {
if (!_.isFunction(item)) {
result[key] = fromJS(item);
}
});
return result;
} else {
return ko.observable(target);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment