Copy recognized mapping properties into root namespace, leave others well alone. #90

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

Contributor

This:

var mapping = {
  ignore: ['a'],
  copy: ['b'],
  include: ['c'],
  create: function(opts) { return opts.data; },
  update: function(opts) { return opts.data; },
  key: function(item) { return ko.utils.unwrapObservable(item.id); },
  arrayChanged: function(event, item) { },
  children: {
    ignore: ['a1'],
    copy: ['b1'],
    include: ['c1'],
    create: function(opts) { return opts.data; },
    update: function(opts) { return opts.data; },
    key: function(item) { return ko.utils.unwrapObservable(item.id); },
    arrayChanged: function(event, item) { }
  }
};

Should result in a ko_mapping like this:

{
  ignore: ['a'],
  copy: ['b'],
  include: ['c'],
  "": {
    create: function(opts) { return opts.data; },
    update: function(opts) { return opts.data; },
    key: function(item) { return ko.utils.unwrapObservable(item.id); },
    arrayChanged: function(event, item) { },  
  },
  children: {
    ignore: ['a1'],
    copy: ['b1'],
    include: ['c1'],
    create: function(opts) { return opts.data; },
    update: function(opts) { return opts.data; },
    key: function(item) { return ko.utils.unwrapObservable(item.id); },
    arrayChanged: function(event, item) { }
  }
};
Collaborator

Excellent, thanks! I'll try to review it tomorrow and merge it in asap.

@RoyJacobs RoyJacobs closed this in 001a83b Jul 23, 2012
Collaborator

This is now merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment