fix dialog.delete: deleteDialog doesn't have to say the filename, for now.

docs README: updated README
This commit is contained in:
Mahdi Dibaiee
2015-09-03 15:57:48 +04:30
parent 79ae4c1a47
commit 8f37f52bec
8 changed files with 113 additions and 17 deletions

View File

@ -1,3 +1,25 @@
import store from 'store';
export function type(obj) {
return Object.prototype.toString.call(obj).slice(8, -1);
}
export function template(string, props) {
return string.replace(/@(\S+)/g, (all, match) => {
return getKey(props, match);
});
}
export function getKey(object = store.getState().toJS(), key) {
let parent = object;
do {
let dot = key.indexOf('.');
if (dot === -1) dot = key.length;
parent = parent[key.slice(0, dot)];
key = key.slice(dot + 1);
} while (key)
return parent;
}