Get the very first directory name from file path
./foo/bar/baz
->foo
or../a/b/c
->../a
Useful when you just want first real directory from given file path
Install
npm i --save get-first-from-filepath
npm test
Usage
For more use-cases see the tests
var getFirstFromFilepath = ; ;//=> 'foo' ;//=> 'foo' ;//=> 'foo' ;//=> '../foo' ;//=> '..foo'
Author
Charlike Mike Reagent
License
Copyright (c) 2015 Charlike Mike Reagent, contributors.
Released under the MIT
license.
Powered and automated by kdf, February 27, 2015