1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Started fixing ReactNative app

This commit is contained in:
Laurent Cozic
2017-07-05 21:34:25 +01:00
parent 9d630ab0ca
commit f0a8cbe95d
50 changed files with 12 additions and 153 deletions

View File

@ -0,0 +1,30 @@
function dirname(path) {
if (!path) throw new Error('Path is empty');
let s = path.split('/');
s.pop();
return s.join('/');
}
function basename(path) {
if (!path) throw new Error('Path is empty');
let s = path.split('/');
return s[s.length - 1];
}
function filename(path) {
if (!path) throw new Error('Path is empty');
let output = basename(path);
if (output.indexOf('.') < 0) return output;
output = output.split('.');
output.pop();
return output.join('.');
}
function isHidden(path) {
let b = basename(path);
if (!b.length) throw new Error('Path empty or not a valid path: ' + path);
return b[0] === '.';
}
export { basename, dirname, filename, isHidden };