17 lines
274 B
JavaScript
17 lines
274 B
JavaScript
|
|
|
|
// @path: normalized path
|
|
var resourceGet = function( data, path ) {
|
|
var i,
|
|
node = data,
|
|
length = path.length;
|
|
|
|
for ( i = 0; i < length - 1; i++ ) {
|
|
node = node[ path[ i ] ];
|
|
if ( !node ) {
|
|
return undefined;
|
|
}
|
|
}
|
|
return node[ path[ i ] ];
|
|
};
|
|
|