Ninety-nine Pitchers of Malt
    Wondering what’s next for npm?Check out our public roadmap! »

    get-first-from-filepath

    1.0.1 • Public • Published

    npm mit license build status coverage status deps status

    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 = require('get-first-from-filepath');
     
    getFirstFromFilepath('foo/bar/baz');
    //=> 'foo'
     
    getFirstFromFilepath('/foo/bar/baz');
    //=> 'foo'
     
    getFirstFromFilepath('./foo/bar/baz');
    //=> 'foo'
     
    getFirstFromFilepath('../foo/bar/baz');
    //=> '../foo'
     
    getFirstFromFilepath('..foo/bar/baz');
    //=> '..foo'

    Author

    Charlike Mike Reagent

    License MIT license

    Copyright (c) 2015 Charlike Mike Reagent, contributors.
    Released under the MIT license.


    Powered and automated by kdf, February 27, 2015

    Install

    npm i get-first-from-filepath

    DownloadsWeekly Downloads

    5

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar
    • avatar