Last active
August 29, 2015 14:17
-
-
Save miguelludert/e1c7b232fb926ba93625 to your computer and use it in GitHub Desktop.
rockout fromJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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