Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets-error-binder
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
205da5be
authored
2014-03-20 12:38:45 -0500
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add "diveIntoObject"
1 parent
b80c9fcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
rivets-error-binder.js
rivets-error-binder.js
View file @
205da5b
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
;
...
...
Please
register
or
sign in
to post a comment