205da5be by Ean Schuessler

Add "diveIntoObject"

1 parent b80c9fcf
1 define(['rivets'], function(rivets) { 1 define(['rivets'], function(rivets) {
2 var diveIntoObject = function(obj, keypath, callback) {
3 if (!keypath) {
4 return callback(obj, null);
5 }
6 //return callback(obj, keypath);
7 var keyparts = keypath.replace(/^:/, '').split(/\./);
8 //console.log('diveIntoObject(keyparts):', obj, keyparts);
9 while (keyparts.length > 1) {
10 var part = keyparts.shift();
11 if (part.length == 0) {
12 continue;
13 }
14 //console.log('diveIntoObject:', obj, part);
15 obj = doObjectRead(obj, part);
16 }
17 //console.log('callback:', obj, keyparts[0]);
18 return callback(obj, keyparts.shift());
19 };
20
2 rivets.binders['error-*'] = { 21 rivets.binders['error-*'] = {
3 bind: function(el) { 22 bind: function(el) {
4 var self = this; 23 var self = this;
......