So Ive got the following javascript which contains a key/value pair to map a nested path to a directory.
function createPaths(aliases, propName, path) {
aliases.set(propName, path);
}
map = new Map();
createPaths(map, 'paths.aliases.server.entry', 'src/test');
createPaths(map, 'paths.aliases.dist.entry', 'dist/test');
Now what I want to do is create a JSON object from the key in the map.
It has to be,
paths: {
aliases: {
server: {
entry: 'src/test'
},
dist: {
entry: 'dist/test'
}
}
}
Not sure if there is an out of a box way to do this. Any help is appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…