Socket
Socket
Sign inDemoInstall

normalize-paths

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    normalize-paths

Use this module to format a path configuration object in order to run it on Unix and Windows systems


Version published
Maintainers
1
Install size
4.32 kB
Created

Readme

Source

normalize-paths

Use this module to format a path configuration object in order to run it on Unix and Windows systems.

Allows you to write a clean path configuration whilst the plugin will take care of normalizing the paths depending on the OS running the script

Installation

With npm do

npm install normalize-paths --save

How to use it

var normalizePaths = require('normalize-paths');

var assetsFolder = __dirname + '/public/assets';

var paths = {
    srcs: {
        js: __dirname + '/scripts/js',
        sass: __dirname + '/sass'
    },
    dest: {
        js: assetsFolder + '/js',
        css: assetsFolder + '/css'
    }
};

module.exports = normalizePaths(paths);

Output on Unix system:

{
  srcs: {
    js: '/home/taddei/project/scripts/js',
    sass: '/home/taddei/project/sass'
  },
  dest: {
    js: '/home/taddei/project/public/assets/js',
    css: '/home/taddei/project/public/assets/css'
  }
}

Output on Windows system:

{
  srcs: {
    js: 'c:\\Users\\taddei\\project\\scripts\\js',
    sass: 'c:\\Users\\taddei\\project\\project\\sass'
  },
  dest: {
    js: 'c:\\Users\\taddei\\project\\public\\assets\\js',
    css: 'c:\\Users\\taddei\\project\\public\\assets\\css'
  }
}

License

MIT

FAQs

Last updated on 22 Aug 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc