You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just testing out some stuff in nodejs and if I were to do:
var ko = require("knockout");
ko.mapping = require("knockout.mapping");
var somePojoWithObservables = new blah();
// populate above
var output = ko.mapping.toJS(somePojoWithObservables);
console.log(output);
It is outputting all the functions etc rather than just the raw object without observables. I notice that this project does not seem to have a package.json and other forks have added this, however it has Steve Sanderson's name on it so I thought it would be best to put down in here.
I have tried just using it without adding to the ko model i.e:
var ko = require("knockout");
var mapping = require("knockout.mapping");
and then using the mapping variable for the mapping jobs, but that gives same result. I am using one of the 11 versions of node, but everything else is working fine (validation and the custom ko.mapping.merge library).
The text was updated successfully, but these errors were encountered:
@grofit When it comes to plugins this is getting tricky. To get the dependency chain right peerDependencies must be used instead of asking the developer to install knockout separately. From you code example I guess that's something either old or due to aforementioned problem.
Thanks for the details. If I were to agree on using 2 instances of KO in (i.e.) nodejs then ko.hasPrototype would need to change to use a string based type check. That would fix this issue. But I still believe that plugins should use peerDependencies, as it's the case for Grunt, for instance.
I was just testing out some stuff in nodejs and if I were to do:
It is outputting all the functions etc rather than just the raw object without observables. I notice that this project does not seem to have a package.json and other forks have added this, however it has Steve Sanderson's name on it so I thought it would be best to put down in here.
I have tried just using it without adding to the ko model i.e:
and then using the mapping variable for the mapping jobs, but that gives same result. I am using one of the 11 versions of node, but everything else is working fine (validation and the custom ko.mapping.merge library).
The text was updated successfully, but these errors were encountered: