Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

normalize-path

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-path - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

18

index.js
/*!
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License
*/
'use strict';
module.exports = function(filepath, stripTrailing) {
filepath = filepath
.replace(/[\\\/]+/g, '/')
.toLowerCase();
module.exports = function(fp, stripTrailing) {
fp = fp.replace(/[\\\/]+/g, '/');
if (stripTrailing === false) {
return filepath;
return fp;
}
return filepath.replace(/\/$/g, '');
return fp.slice(-1) === '/'
? fp.slice(0, fp.length -1)
: fp;
};
{
"name": "normalize-path",
"description": "Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.",
"version": "0.3.0",
"version": "1.0.0",
"homepage": "https://github.com/jonschlinkert/normalize-path",

@@ -17,8 +17,18 @@ "author": {

},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jonschlinkert/normalize-path/blob/master/LICENSE-MIT"
}
],
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/normalize-path/blob/master/LICENSE-MIT"
},
"files": ["index.js"],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha -R spec"
},
"devDependencies": {
"benchmarked": "^0.1.1",
"mocha": "*"
},
"keywords": [

@@ -34,16 +44,3 @@ "file",

"unix"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha -R spec"
},
"devDependencies": {
"benchmarked": "^0.1.1",
"mocha": "*",
"should": "^4.0.4",
"verb": "^0.2.15"
}
]
}

@@ -5,4 +5,3 @@ # normalize-path [![NPM version](https://badge.fury.io/js/normalize-path.svg)](http://badge.fury.io/js/normalize-path)

## Install
#### Install with [npm](npmjs.org)
## Install with [npm](npmjs.org)

@@ -13,8 +12,2 @@ ```bash

## Run tests
```bash
npm test
```
## Usage

@@ -25,6 +18,6 @@

console.log(normalize('\\foo\\bar\\baz\\'));
normalize('\\foo\\bar\\baz\\');
//=> '/foo/bar/baz'
console.log(normalize('./foo/bar/baz/'));
normalize('./foo/bar/baz/');
//=> './foo/bar/baz'

@@ -36,9 +29,16 @@ ```

```js
console.log(normalize('./foo/bar/baz/', false));
normalize('./foo/bar/baz/', false);
//=> './foo/bar/baz/'
console.log(normalize('foo\\bar\\baz\\', false));
normalize('foo\\bar\\baz\\', false);
//=> 'foo/bar/baz/'
```
## Run tests
```bash
npm i -d && npm test
```
## Contributing

@@ -55,3 +55,3 @@ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/normalize-path/issues).

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license

@@ -61,2 +61,2 @@

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 24, 2014._
_This file was generated by [verb](https://github.com/assemble/verb) on January 23, 2015._
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc