Knockout Mapping plugin
Object mapping plugin for Knockout
Official documentation here.
bower install bower-knockout-mapping --save-dev
npm install knockout-mapping --save
var data =email: 'firstname.lastname@example.org'name: 'demo'addresses:type: 'home' country: 'Romania' city: 'Cluj'type: 'work' country: 'Spain' city: 'Barcelona';// Create a view model from datavar viewModel = komapping;// Now use the viewModel to change some values (properties are now observable)viewModel;viewModelname'demo2';viewModel0;// Retrieve the updated data (as JS object)var newData = komapping;// newData now looks like thisemail: 'email@example.com'name: 'demo2'addresses:type: 'home' country: 'Romania' city: 'Bucharest'type: 'work' country: 'Spain' city: 'Barcelona'
Run this example in JSFiddle.
Continuous Integration tests are done with Travis, and the associated Gulp task is
test task is used, which runs the tests against the latest version of Knockout.