projects
/
platform
/
framework
/
web
/
crosswalk-tizen.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
c6e79f635e9651feb7a958b322418d0fde1ec4f3
[platform/framework/web/crosswalk-tizen.git]
/
1
var forEach = require('../array/forEach');
2
3
/**
4
* Create nested object if non-existent
5
*/
6
function namespace(obj, path){
7
if (!path) return obj;
8
forEach(path.split('.'), function(key){
9
if (!obj[key]) {
10
obj[key] = {};
11
}
12
obj = obj[key];
13
});
14
return obj;
15
}
16
17
module.exports = namespace;
18
19