You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

normalize-paths

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

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

1.1.8
latest
Source
npmnpm
Version published
Weekly downloads
31
1450%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 22 Aug 2016

Did you know?

Socket

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