Nomenclature Predictably Misunderstood
    Have ideas to improve npm?Join in the discussion! »

    caroot

    1.1.0 • Public • Published

    caroot

    Replaces a caret with the root path (closest package.json)

    Usage

    caroot(caretedPath, currentPath[, rootSubDirectory])

     
    var caroot = require('caroot');
     
    // assume we are 2 levels deeper than package.json
     
    caroot('^foo', __dirname);
     
    // returns '../../foo'
     
     
    // also takes an optional root sub directory
     
    caroot('^foo', __dirname, './scripts');
     
    // returns '../foo'
     

    Install

    npm i caroot

    DownloadsWeekly Downloads

    61

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • avatar