205da5be by Ean Schuessler

Add "diveIntoObject"

1 parent b80c9fcf
define(['rivets'], function(rivets) {
var diveIntoObject = function(obj, keypath, callback) {
if (!keypath) {
return callback(obj, null);
}
//return callback(obj, keypath);
var keyparts = keypath.replace(/^:/, '').split(/\./);
//console.log('diveIntoObject(keyparts):', obj, keyparts);
while (keyparts.length > 1) {
var part = keyparts.shift();
if (part.length == 0) {
continue;
}
//console.log('diveIntoObject:', obj, part);
obj = doObjectRead(obj, part);
}
//console.log('callback:', obj, keyparts[0]);
return callback(obj, keyparts.shift());
};
rivets.binders['error-*'] = {
bind: function(el) {
var self = this;
......